Support » Plugins and Hacks » Is Profiler compatible with Register Plus

Viewing 15 replies - 1 through 15 (of 15 total)
  • Should be, I’m not familiar with it however so I don’t know if its able to display the custom fields or not.

    User defined fields are not supposed at this time. Support for various profile plugins will be added in the future.

    How about a way to just add the custom fields to the normal profile update page?

    In fact they are not compatible. But it would only take little effort to make them work together. Result? Probably the biggest step towards making WordPress a community thing!

    I am very new to WordPress and php so, maybe if you help me, we could make this work.

    “Register plus” stores the custom fields in MySQL table usermeta. We just need to edit profiler.php by adding a couple of new variables and functions. For example, I have added a custom field “gender” and have a row in usermeta: userid 289 / meta_key gender / meta_value male

    In profiler.php before this bit: if($user_description != '')
    we need to add something like

    $user_custom_gender = "SELECT meta_value FROM usermeta WHERE metakey = 'gender' AND WHERE userid = '$id'";

    Please let me know what you think, maybe you have ideas on how to make this work correctly.

    Thank you.

    I meant to say “User defined fields are not supported at this time.”

    It is not as easy as you make it out to be. The plugin has to automatically recognize the custom values, their types, and whether or not the user wants to display them in the directory or profiles. It is not extremely hard to do, but it does take more time than you are suggesting.

    Register Plus is not the only plugin I was considering adding support for in the next release. I have been busy with other projects, but I might be able to finish this soon.

    It worked for me with a simple
    . $vars['your_custom_field'] .

    It’s near line 606 in profiler.php

    mehd36, please expound! i would love to hear more… ive been looking to do this for a while and im new to php so im not well versed just yet… thanks!

    edit: i explored the profiler.php file near line 606 and from what i understand, adding the extra fields here would include those fields on the directory listing page, is that correct? what about on the profile view page?

    Well, I just use the directory function of profiler…
    But for the directory function :

    • seek the line $output .= '<table border="0">'; near line 577 in profiler.php
    • add the custom information you want into a <th> tag. Just before $output .= '</tr>';, add, for example : $output .= '<th>Telephone number</th>';
    • then, juste before $output .= "</tr>";, near line 608, add
      $output .= "<td>" . $vars['phone_number'] . "</td>";
      replace phone_number with the custom field you made. For example, if with Register Plus you made a custom field called “Phone Number”, you’ll have to put “phone_number”

    I hope it’ll be useful…
    Sorry for my bad english, I’m french and I’m only 16.

    dont you need to add (for example, if the custom filed name is birthday):

    $vars[‘birthday’] = get_usermeta($id, ‘birthday’);

    in the pf_get_vars($id) function?

    No, I didn’t have to do it. I use the latest versions of register_plus, wordpress and profiler.

    This is great!

    Af3, I did need to add:

    $vars['birthday'] = get_usermeta($id, 'birthday');

    Here is what my code for the profile looks like:

    $vars['country'] = get_usermeta($id, 'country');
    	$vars['age'] = get_usermeta($id, 'age');
    	$vars['favorite_animal'] = get_usermeta($id, 'favorite_animal');
    	$output .= "<p>$display_name<br />";
    	if(get_option('pf_show_emails') == 'yes')
    		$output .= "Email:  <a href=" . "mailto:" . $user_email . ">" . antispambot($user_email) . "</a><br />";
    	if($user_url != '' && $user_url != 'http://')
    		$output .= "Website:  <a href=" . $user_url . " rel=\"nofollow\">$user_url</a><br />";
    	if($vars['age'] != '')
    		$output .= "Age: " . $vars['age'] . "<br />";
    	if($vars['country'] != '')
    		$output .= "Country: " . $vars['country'] . "<br />";
    	if($vars['favorite_animal'] != '')
    		$output .= "Favorite Animal: " . $vars['favorite_animal'] . "<br />";
    	$output .= "Join date:  " . pf_format_datetime($user_registered) . "</p>";

    That adds the three custom fields (age, country and favorite animal) in the profile.

    Thank you all! now I just need to figure out how to get bbPress to point to this profile….

    dchase, mehd36, this is still not working in my blog. I have WP 2.7, Register Plus 3.5.1 and Profiler 1.2.8. I did add few more fields but instead of list in “User profile”, I get few more columns in the “Registered users” table, and User profile didn’t change (still no additional filled fields in user profile).

    What am I doing wrong? Please help!
    This is the source code:

    function pf_output_directory($start, $records, $lastpage)
    	$uids = pf_uids($start, $records, get_option('pf_sort_directory_by'), get_option('pf_sort_directory_order'));
    	$page = round($_GET['page']);
    	$character = pf_directory_url_char();
    	$output .= '<table border="0">';
    	$output .= '<tr>';
    	$output .= '<th>Name</th>';
    	if(get_option('pf_roles_enabled') == 'yes')
    		$output .= '<th>Role</th>';
    	if(get_option('pf_show_emails') == 'yes')
    		$output .= '<th>Email</th>';
    	$output .= '<th style="text-align: center;">Website</th>';
    	$output .= '<th>Joined</th>';
    	$output .= '<th>Gender</th>';
    	$output .= '<th>Edge</th>';
    	$output .= '<th>Location</th>';
    	$output .= '<th>Favourite music</th>';
    	$output .= '<th>Favourite book</th>';
    	$output .= '</tr>';
    	foreach($uids as $key=>$value)
    		//sets the required variables for the current user in the loop
    		$vars = pf_get_vars($value);
    		$vars['ID'] = pf_get_display_name($vars['ID']);
    		$vars['gender'] = get_usermeta($id, 'gender');
    		$vars['edge'] = get_usermeta($id, 'edge');
    		$vars['location'] = get_usermeta($id, 'location');
    		$vars['favourite_music'] = get_usermeta($id, 'favourite_music');
    		$vars['favourite_book'] = get_usermeta($id, 'favourite_book');
    		//get the user's role as a title
    		if(get_option('pf_roles_enabled') == 'yes')
    			$role = ucfirst(pf_user_role($vars['wp_capabilities']));
    		$output .= "<tr>";
    		$output .= "<td><a href=" . $_SERVER['REQUEST_URI'] . $character . "user=" . $vars['ID'] . ">" . $vars['display_name'] . "</a></td>";
    		if(get_option('pf_roles_enabled') == 'yes')
    			$output .= "<td>" . $role . "</td>";
    		if(get_option('pf_show_emails') == 'yes')
    			$output .= "<td><a href=" . "mailto:" . $vars['user_email'] . ">" . antispambot($vars['user_email']) . "</a></td>";
    		//only display the url if they have entered a url
    		if($vars['user_url'] != 'http://' && $vars['user_url'] != '')
    			$output .= '<td style="text-align: center;">' . "<a href=" . $vars['user_url'] . " rel=\"nofollow\">www</a></td>";
    			$output .= "<td />";
    		$output .= "<td>" . pf_format_datetime($vars['user_registered']) . "</td>";
    		if($vars['gender'] != '')
    			$output .= "Gender: " . $vars['gender'] . "</td>";
    		if($vars['edge'] != '')
    			$output .= "Edge: " . $vars['edge'] . "</td>";
    		if($vars['location'] != '')
    			$output .= "Location: " . $vars['location'] . "</td>";
    		if($vars['favourite_music'] != '')
    			$output .= "Favourite music: " . $vars['favourite_music'] . "</td>";
    		if($vars['favourite_book'] != '')
    			$output .= "Favourite book: " . $vars['favourite_book'] . "</td>";
    		$output .= "</tr>";

    Note, I’m not a programmer, not even php learner :).



    Thanks mehd36 for your help!
    Just what I was looking for. I can see my custom fields on the profile page, all though the same info will not display in the directory… any suggestions?

    Perhaps easier instructions:

    In profile.php find line 76 which says:
    //let's see if this works any better than strictly using $vars['wp_capabilities']

    add after line 77 which says:
    $vars['wp_capabilities'] = get_usermeta($id, 'wp_capabilities');
    your variables like so:

    $vars['your_gender'] = get_usermeta($id, 'your_gender');
            $vars['your_age'] = get_usermeta($id, 'your_age');

    (These variable come from the wp_usermeta table)

    Now go to around line 460 which says:
    $output .= "$display_name";

    After that you can add your stuff like so:

    if($vars['your_gender'] != '')
    		$output .= "<p>Gender: " . $vars['your_gender'] . "</p>";
            if($vars['your_age'] != '')
                    $output .= "<p>Age: " . $vars['your_age'] . "</p>";

    I added it after the bit:
    $output .= "Website: <a href=" . $user_url . " rel=\"nofollow\">$user_url</a>";

    I hope that this might be a bit easier to follow.
    That’s my 2 cents worth anyway and it works like a charm using data from “Register Plus.”

    $vars[‘country’] = get_usermeta($id, ‘country’);
    $vars[‘age’] = get_usermeta($id, ‘age’);
    $vars[‘favorite_animal’] = get_usermeta($id, ‘favorite_animal’);

    $output .= “<p>$display_name
    if(get_option(‘pf_show_emails’) == ‘yes’)
    $output .= “Email: ” . antispambot($user_email) . “
    if($user_url != ” && $user_url != ‘http://’)
    $output .= “Website: $user_url
    if($vars[‘age’] != ”)
    $output .= “Age: ” . $vars[‘age’] . “
    if($vars[‘country’] != ”)
    $output .= “Country: ” . $vars[‘country’] . “
    if($vars[‘favorite_animal’] != ”)
    $output .= “Favorite Animal: ” . $vars[‘favorite_animal’] . “

    $output .= “Join date: ” . pf_format_datetime($user_registered) . “</p>”;

    Just letting you guys know that this works perfectly.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Is Profiler compatible with Register Plus’ is closed to new replies.