Support » Plugin: amr users » parameters work in url, not in shortcode

  • Resolved maarteno

    (@maarteno)


    Very nice and flexible plugin. I am trying to push the limits of the plugin and wanted to use it to create lists of users with a certain value from a list of values defined via s2member. Very much like regions and specialty on the demo page (http://directories.wpusersplugin.com/simple-user-list/). I’ve got it working to create the list, but i cannot use the shortcode to create a sub-list with people from only one region for example, while I can use a url with the same values.

    e.g. this doesn’t work, but the same values in a url works:
    [userlist list=5 filter=show wp_s2member_custom_fields-region=Europe]

    Different but related, I used Advanced Custom Fields to set up Regions as user fields to see if that worked (and linked this to a custom taxonomy to fill in the regions), but that returned field_51cd002fad748 upon trying to display those values. Too bad.

    For the rest, very nice plugin!

    http://wordpress.org/extend/plugins/amr-users/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author anmari

    (@anmari)

    Hi Marteno,

    You know you can use exclude and include features in the list settings?

    http://wpusersplugin.com/3703/exclude-or-selectively-include-users-without-displaying-the-criteria-field/

    eg: you could have a list with region field ‘include’ value set to Europe

    Re: field_51cd002fad748
    the plugin unless it has some code to tell it how to format a field, will display the value it finds in the user meta. In this case it must be finding field_51cd002fad748.
    Most likely you could write a formatting function to lookup the descriptive name based on what is in the usermeta and display that.

    The plugin looks for existence of formattingfunction based on field name (be careful with hyphens etc… converted to underscores so code will work.

    See http://wpusersplugin.com/2645/format-any-field-any-way-you-wish/
    and http://wpusersplugin.com/2823/formatting-and-pluggable-functions/

    Thread Starter maarteno

    (@maarteno)

    Hi Anmari,

    Yes, I can create lists that includes or excludes certain regions. The reason I go the other way is that I want the system to be flexible, ie. when people visit the Europe taxonomy page I want to automatically generate a Europe user list based on the taxonomy they visit. So ideally I put the taxonomy term, ie. Europe in the shortcode (or probably even better would be directly in php if possible). Then when I add a region, I don’t have to add another list. That way my users menu won’t be filled with 30 or so user lists and I can add a field to all user lists by changing one instead of 30.

    I know one can write a function (i did a few simple ones to format certain fields). But I’m probably not the person to do an advanced function. If you take work I’d be happy to see if we can come to some kind of financial understanding (see my website for contact info). A full Advanced Custom Fields integration would be nice for the plugin 🙂

    Maybe the last remark holds a clue, ‘be careful with hyphens’, maybe the dash in wp_s2member_custom_fields-region trips the shortcode?

    Thanks,
    Maarten

    http://maartenottens.com

    Thread Starter maarteno

    (@maarteno)

    Seems there is a similar problems with rows_perpage, which works as rows_per_page in the url, but not in the shortcode.

    Thread Starter maarteno

    (@maarteno)

    I managed to fix the rows_per_page issue by adding

    if (isset($options['rows_per_page'])) { // number of rows per page
    		$rowsperpage = $options['rows_per_page'];
    	} else

    above line 352 in ameta-list.php

    Thread Starter maarteno

    (@maarteno)

    The initial s2member filter problem had indeed to do with the dash in the name. I made another change in ameta-list.php to activate fieldnamefilter and fieldvaluefilter, to circumvent the problem. I added

    if (isset ($options['fieldnamefilter']) AND isset ($options['fieldvaluefilter'])) {
    				$filtercol[$options['fieldnamefilter']] = $options['fieldvaluefilter'];
    			}

    after
    foreach ($icols as $cindex => $col) { ... }
    The shortcode does need a filter option for it to pick up on the field parameters. It works like a charm. Any chance this can be part of the next release?

    Thanks, M

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘parameters work in url, not in shortcode’ is closed to new replies.