• Resolved chrishechler

    (@chrishechler)


    Hi Andrea,

    I just tried out the 3rd party plugin “Member Swipe”. I was wondering if it was possible to create a new BP search form and hook that into the swipe plugin so that I have 1 BP Search form for the “Members” page/directory and one for the swipe plugin page.

    To be more detailed, I will create a new page and use the member swipe plugin there. I was just hoping I could also create a BP Search form to let members search the member swipe results. As far as I know the plugin also uses (the same main?) directory so I am not sure if there will be an overlap/conflict then to the “Members” page directory.

    Would be awesome if I could somehow hook into the member swipe with a 2nd BP Search form.

    Thanks in advance ??

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

    (@dontdream)

    Hi Chris,

    You can declare your Swipe page as a custom members directory, by adding this code to your bp-custom.php file:

    add_filter ('bps_add_directory', 'add_swipe_page');
    function add_swipe_page ($dirs)
    {
    	$dir = new stdClass;
    	$page_id = 1781;    // replace as needed
    	$dir->id = $page_id;
    	$dir->title = "Swipe Members";    // replace as needed
    	$dir->path = parse_url (get_page_link ($page_id), PHP_URL_PATH);
    	$dirs[$page_id] = $dir;
    
    	return $dirs;
    }
    

    Then you can use one of your BP Profile Search forms and select the new “directory” as its Target Directory.

    Please note that the above code only works with BP Profile Search 5.7.4+ or BP Classic.

    Thread Starter chrishechler

    (@chrishechler)

    Hi Andrea, sorry to follow-up on this topic.

    Your code lets me now select the directory on the page I chose. So that is pretty great ?? But how do I get a custom directory onto that page now (if I do not use the member swipe plugin)?

    I saw on your website https://dontdream.it/ that you outline these steps:

    Copy index.php to index-2.php and members-loop.php to members-loop-2.php and then add them to child theme. Then use the shortcode [bps_directory template=”members/index-2, members/members-loop-2″] to place the custom directory on the page.

    May I simply ask to understand this more why:

    1. both templates? index.php + members-loop.php and not just the members-loop.php file?
    2. why add them to the child theme and not simply duplicate them and leave them in the same folder? Just to avoid update changes that might affect the new custom directory then or are there other reasons behind it?

    Thanks again in advance, really appreciate it ??

      Plugin Author Andrea Tarantini

      (@dontdream)

      Hi Chris,

      The above code snippet is only needed if you use it with Member Swipe.

      To create a custom directory you only need the [bps_directory] shortcode, with no attributes. Using the template attribute:

      [bps_directory template='members/index-2, members/members-loop-2']

      is necessary when you want to use a custom directory template.

      In general you have to modify both files, index.php and members-loop.php, to fully customize the members directory, that’s why the shortcode needs both.

      It’s suggested to use a child theme to avoid losing your new templates on the next theme update.

      Thread Starter chrishechler

      (@chrishechler)

      Hello Andrea, thanks for the info ??

      The reason I was asking is because I am trying to create a new plugin to replace the outdated “Member Swipe” plugin which in its current state does not receive support and updates anymore. (Also, when I tested it I encountered some issues such as some user profile avatars not correctly displaying, etc.).

      I know that I could use the [bps_directory] shortcode but since I create a new plugin I might as well create the custom directory right inside of it.

      You said to include both the index.php and members-loop.php, to fully customize the members directory. If I added them to the plugin, how would I go about it then? How would you start to create a custom directory in a new plugin?

      So, I would like to create a new plugin that lets me display a custom directory which will work with BP Search Form plugin to filter for users/user details.

      I am aware that this question goes further than simple plugin support, I am just hoping for the best.

      Always appreciate your input, Andrea ??

      Plugin Author Andrea Tarantini

      (@dontdream)

      Hi Chris,

      To create a custom directory in your new plugin, you could replicate the BP Profile Search code in the bps-directory.php file or, if you plan to use BPS with your new plugin, you can simply leverage the BPS 'bps_add_directory' filter, as shown in the code snippet above.

      If you add directory templates to your new plugin, you could use the BuddyPress 'bp_get_template_stack' filter to add your template folder to the stack, and use the BPS 'bps_directory_data' filter to add the template attribute to your directory.

    Viewing 5 replies - 1 through 5 (of 5 total)
    • The topic ‘How to use BP Search for Member Swipe plugin?’ is closed to new replies.