Skip Navigation

[Gelöst] How to filter parent posts by user

This support ticket is created vor 7 Jahre, 6 Monate. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Dieses Thema enthält 18 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Shane vor 7 Jahre, 6 Monate.

Assistiert von: Shane.

Author
Artikel
#457947

One more thing, please.

I have a View that lists all the issues. One of its fields is 'assigned-resources' which should receive a value from the edit/create CRED form. Now in the form we have a related select field and I need to copy this value to the 'assigned-resources' field in order to display it in the views.

I created a hidden field with that name to pass the value from a function.

Here is the code in the edit/create CRED form:

      <div class="cred-group cred-group-parents">
  			<div class="cred-field cred-field-_wpcf_belongs_stock_id">
    <label class="cred-label">
Assigned resources
    </label>
    <input type="hidden" id="parents_id" value='[get-parents]' />
      [cred_field field='_wpcf_belongs_stock_id' value='']
    <input type="hidden" name="wpcf-assigned-resources" value='' />
  			</div>
		</div>

The function that i'm using:

add_filter('cred_save_data','my_assigned_resources',10,2);

function my_assigned_resources($post_id, $form_data) {
	if ($form_data['id']==185 || $form_data['id']==252) {
		if (isset($_POST['_wpcf_belongs_stock_id'])) {
			update_post_meta($post_id, 'wpcf-assigned-resources', $_POST['_wpcf_belongs_stock_id']);
		}
	}
}

I'm doing something wrong or it's not the best solution to resolve this. Can you help me?

Thank you.

#458110

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Carlos,

So you want to copy the selected value into this field ?
<input type="hidden" name="wpcf-assigned-resources" value='' />

Please let me know.
Thanks,
Shane

#458121

Yes, exactly. I want to copy the value in order to display it in a new view. I don't know if it's possible to display directly the value of the select (related field) in other view.

#458366

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Carlos,

Actually this is possible with some javascript.

Take a look at the link below.
versteckter Link

This shows you how you can get the value from a select field.

Please let me know if this helps.
Thanks,
Shane

Dieses Ticket ist jetzt geschlossen. Wenn Sie ein Toolset Kunde sind und Hilfe benötigen, eröffnen Sie bitte ein neues Support-Ticket.