Profile Builder Beta

There’s a new version of Profile Builder WordPress plugin. It features the following new features:

  • New interface
  • Create Extra User Fields (like birthdate or education level)
  • Add avatar upload for users and automatic integration with any theme that uses get_avatar()
  • Shortcodes for login, register and edit profile to use in pages and widgets.
  • Select what fields appear in the register and edit-profile pages.
  • Select if the admin bar should be present on the front end for user-groups.
  • Select if to use the default css or not.

You can sign up for the beta from this page: Profile Builder beta

The new interface was borrowed from the awesome plugin OptionTree created by Derek Herman

About Cristian Antohe

Cristian Antohe is the co-founder Cozmoslabs. He's a WordPress developer, web designer and Open Source fanatic. He's part of the team that developed Profile Builder and WordPress Creation Kit and also helps curate wpMail.me.

Find me on: Google + | Twitter

79 thoughts on “Profile Builder Beta

  1. Bug report: a lot extra <i> in the code on the profile edit front-end page.

    Hi! I’ve just used your plugin. The Pro version is awesome! Thank you very much! Just 1 bug I’ve found: in front-end on the edit profile page I have a lot of extra tags <i> not only in the content layout but in the all another area. As I see they are generated with JS, because I can’t find them in the page code, but see them with the firebug. I have no such a problem on the register page, just on the profile edit page: a lot of unnessesary extra <i> tags, that are generated in the different parts of the page layout and some of them wrap the whole content. I’m sure, this is not template problem. You may see the problem if register (2beauty.ru/registraciya) and then edit your profile (2beauty.ru/redaktirovanie-profilya).

    Thank you!

    • Hello, nikolas_sharp!
      Thank you for your bug report; I took a look at the front-end edit profile code, and I couldn’t find any < i > tags which don’t have a closing tag (< / i >), neither could I find any issues on your website with firebug. Could you please be specific as in where these “glitches” appear? Or even better – if you could – to copy-paste a part of this code right from firebug for me to see? Would help me understand the issue better.
      Thanks in advance,
      Gabriel

      • Here is the full code from firebug: 2beauty.ru/extra-i.txt. With notepad++ I see, that extra <i> are opened on lines 113,117,178 and 688. All they are closed, but the problem is that they should not be at all.

        • Those < i > tags are indeed hard-coded, I will change them these days. I will keep you posted.
          Gabriel

        • Hello again,
          I replaced the < i > tags with a < span > tag, but it still needs the CSS associated to it.
          If you want it so, w/o the CSS, just send me another sign-up e-mail.
          Gabriel

  2. Hi,

    Great plugin!
    One question though; I cannot get the admin bar to show up for the admin anymore. It does not show up for anyone now and I want to be able to see it.
    In the settings I chacked the visible field for everyone except ‘readers’, the lowest level.

    Can you help me? If I disable your plugin, the admin bar shows up!

    Thanks again.

  3. Hy there Martijn,
    Did you do anything (like modifying its visibility) before or you installed the plugin and the admin bar didn’t appear?
    Gabriel

  4. Hi Gabriel,

    No, this is the first time that I wanted to have people register themselves so this is the first time that I looked for the function of disabling the admin bar. Before it was standard use of the admin bar, which was shown all the time for me.

    Regards,
    Martijn

    • Hi Martijn again,
      I promise I will look into it today (later on), but that’s the exact reason I asked you to post more detailed info so I can simulate exactly your case. As for the tests we did before releasing this plug-in covered a lot of test-cases.
      Still, I will check the issue with the admin bar, as I said and will get back to you in about 5 hours from now.
      Gabriel

        • Hello,
          I looked at the issue, enabled/disabled the admin bar on the front-end and it works as intended. Sorry :(
          There might be a plugin/theme conflict, as I only tested PB with a few plugins and thematic/2-3 custom themes.
          Try using the minimal, and try it out. Or you can try it uninstalling it and reinstalling it.
          Keep me posted with the updates.

          Gabriel

      • Hi,

        It’s not one of the plugins…
        Is there a way to disable this function of the plugin? Then I can use another one to disable the admin bar.

        Thanks

        • yes, just comment the following line in your plugin_folder_name/functions/functions.load.php:

          /* set the front-end admin bar to show/hide */
          add_filter( ‘show_admin_bar’ , ‘wppb_show_admin_bar’);

          this will effectively disable the admin bar function from a few rows up in the same file (so something like this:

          /* set the front-end admin bar to show/hide */
          // add_filter( ‘show_admin_bar’ , ‘wppb_show_admin_bar’);

          )

          Gabriel

      • Hmm..Sorry, but I don’t get it. Where is this file? I want to disable the function in your plugin so the admin bar is shown and I can use another plugin the hide it from other users.
        But, I cannot find this file in your plugin.

        Thanks!

  5. Hi,
    Its an awsome plugin. I was searching for this kind of plugin since a long and had decided to build up from scratch. But luckily got this one.
    However, after some testing, after removing all custom fields, I am not able to add any new field. Seems like some Javascript bug. (Browser is not complaining any JS error though!). Is there any way that I can insert a default custom field directly to database?

    • Hello,
      yes, inserting directly in the DB can work, and I will paste a code sample later on today, but I don’t get it: what happened exactly? you added custom fields, they appeared on the front-end, then you deleted them (all?) and from that moment on you couldn’t add any new ones?
      I will ask you also to post a bit more details.
      Gabriel

      • Here is the structure of the custom fields:

        array( array(id => 1, item_id => ‘default_header’, item_title => ‘Extra Profile Fields’, item_desc => NULL, item_type => ‘heading’, item_options => NULL, item_sort => 0) )

        this is the default for when you install profile builder; you need to add this in the wp_options table under the wppb_custom_fields key
        NOTE: this is php code (and I will also post the whole part for adding 1 header extra field:

        $arraySettingsPresent = get_option(‘wppb_custom_fields’,’not_found’);
        if ($arraySettingsPresent == ‘not_found’){
        $wppbMultyArray = array( array(id => 1, item_id => ‘default_header’, item_title => ‘Extra Profile Fields’, item_desc => NULL, item_type => ‘heading’, item_options => NULL, item_sort => 0) );
        add_option( ‘wppb_custom_fields’, $wppbMultyArray);
        }

        ). You can paste this into a functions file or run it from a simple script.
        As I said that was php code, you can also create the key manually and insert the following code directly into the db:

        a:4:{i:0;a:7:{s:2:”id”;i:1;s:7:”item_id”;s:14:”default_header”;s:10:”item_title”;s:20:”Extra Profile Fields”;s:9:”item_desc”;N;s:9:”item_type”;s:7:”heading”;s:12:”item_options”;N;s:9:”item_sort”;i:0;}i:1;a:7:{s:2:”id”;i:2;s:7:”item_id”;s:2:”up”;s:10:”item_title”;s:6:”upload”;s:9:”item_desc”;s:0:””;s:9:”item_type”;s:6:”upload”;s:12:”item_options”;s:0:””;s:9:”item_sort”;i:1;}i:2;a:7:{s:2:”id”;i:3;s:7:”item_id”;s:4:”avat”;s:10:”item_title”;s:6:”avatar”;s:9:”item_desc”;s:0:””;s:9:”item_type”;s:6:”avatar”;s:12:”item_options”;s:2:”20″;s:9:”item_sort”;i:2;}i:4;a:7:{s:2:”id”;i:5;s:7:”item_id”;s:3:”sel”;s:10:”item_title”;s:3:”sel”;s:9:”item_desc”;s:0:””;s:9:”item_type”;s:6:”select”;s:12:”item_options”;s:11:”1,2,3,4,5,6″;s:9:”item_sort”;i:4;}}

        this information is the way SQL stores arrays (and thus WP). For the above code you would get an
        *a header field, with the name Extra Profile Fields
        *upload input type, with the name upload
        *avatar input type, with the name avatar and the size of it set to 20px
        *select input type, with the name sel and its options being 1,2,3,4,5,6

        Hope this was helpful, if not feel free to ask again,
        Gabriel

        • Hi Gabriel,

          Thanks for quick reply.
          Actually, I added few custom fields to check how it works. (and I gave meaning-less names to those fields (e.g, field1/field2..). And it was working perfectly. So I decided to start it from scratch and deleted all those custom fields. Now after this, when I tried to add a new field, it tossed up.

          After posting, I just went through your code and wp_options table.
          I found there was an entry for option ‘wppb_custom_fields’ with value ‘a:1:{}’ (it was something like this.. I didnt remember exact value). So I just deleted this entry from the table, and it start working properly.

          So I think to fix this bug, one should put the default data in the table if all custom-fields are being removed. Or have to check the size of an array along with ‘not_found’ check.

          Regards,
          Nirmit

        • Glad to hear that Nirmit :)
          although in the uninstall file there is a little line:

          delete_option( ‘wppb_custom_fields’ ); // Delete the default fields

          which should automatically fix your issue if you uninstall/reinstall the plugin :D

          Regards,
          Gabriel

  6. the upload avatar doens seem to work, i get the following error

    There was an error while trying to upload your avatar picture.
    Possible cause: size/incorrect file-type.
    The avatar was NOT updated along with the rest of the information.

    the file size is only 8k and the file type is jpg
    what could be wrong?

    • Hello Chris,
      one reason could be that you don’t have permission to modify folder contents on (your) server. Have you tried uploading an attachment? Does that work?
      Keep me posted,
      Gabriel

  7. i did have the the ‘user avatar’ plugin installed and that uploaded images fine, i have also uploaded other images onto pages etc without any problem.

  8. That’s odd, I have looked for those folders and they do exist ad the files I uploaded previously ARE in there – but the profile page is saying’ Current avatar:No uploaded avatar’

  9. i was thinking it may be my browser so i tried it in firefox instead of IE8 and this happened

    Warning: imagecreatefromjpeg(http://www.perthrollerderby.com.au/wp-content/uploads/profile_builder/avatars/userID_1_originalAvatar_w7 home_prem.jpg) [function.imagecreatefromjpeg]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/perthrd/public_html/wp-content/plugins/ProfileBuilderProBeta/front-end/wppb.edit.profile.php on line 229

    Warning: getimagesize(http://www.domain.com.au/wp-content/uploads/profile_builder/avatars/userID_1_originalAvatar_w7 home_prem.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/perthrd/public_html/wp-content/plugins/ProfileBuilderProBeta/front-end/wppb.edit.profile.php on line 236

    Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/[user]/public_html/wp-content/plugins/ProfileBuilderProBeta/front-end/wppb.edit.profile.php on line 242

    Warning: imagedestroy(): supplied argument is not a valid Image resource in /home/[user]/public_html/wp-content/plugins/ProfileBuilderProBeta/front-end/wppb.edit.profile.php on line 247

    any ideas

  10. yes it uploads on that profile on firefox but not on IE8 – i tried IE8 on 2 different computers one running win7 and the other running XP – i know it sounds odd but thats what is happening – have you tried IE?

    • another odd thing – if i view users profiles – they all have the same avatar – the one i uploaded, i delete it from the profile i am lodged into and it deletes but if i try and delete it from another users profile i get a message Invalid user ID.

      • And regarding your second issue: that should not happen, it is coded that it will delete the current users’ avatar … I will check this issue though closely tomorrow, since I am leaving now.
        Gabriel

  11. no its not working on IE8 – have you tried it on IE??

    it works on firefox and i also tried it on google chrome and it works on there too just an issue with IE

    give it a try

    • I tried it in IE, and indeed it gives an error while trying to upload avatar, although the upload works fine(tried uploading an archive and an image).
      I will need to look into this first locally and then I will upload the fixed version ASAP.
      I will post here when I managed to fix this issue.
      Gabriel

  12. thanks – also did you notice if in the backend you click on edit for any user it shows the same avatar for all users, the one you uploaded(Hydrangeas.jpg)

    also on anothre note, im working on a plugin of my own – nothing too flash but how would i display an extra field of a user other than the one currrently logged in, im stil a beginner

    • Hello Chris,
      I found the issue with the IE and managed to fix it (FYI: when uploading avatar I checked to see if it’s one of the following file-types: image/jpeg, image/png or image/bmp … only issue is that IE converts image/jpeg into image/pjpeg and image/png into image/x-png, so basicly it never entered the if statement).
      We will release a final beta version next week.
      Regarding the user-avatars, as far as I can remember, I found a work-around for that problem, but it can be I missed something, so I will check it out next week.

      I will, however, post you some code for adding a default field:
      *to create an input field: create in the usermeta table a metakey (let’s say) my_input with the value (this is php script, DON’T copy paste this directly into the database): my_array = array(‘type’ => ‘text_input’, ‘value’ => ”);
      *run the above php code (there might be some errors, as I am typing these manually, w/o testing
      *generate your code:
      $x=get_user_meta( $userID, ‘my_input’ );
      *this check is currently useless, since we only have 1 input in our array, but needed if we have several, might use foreach in that case

      < ?php (if $x['type'] == 'text_input') echo ' < input type = "text" name="displayedText" value="'.$x['value'].'" / >‘; ?>

      *now for the saving part
      $tempArray = array(‘type’ => ‘text_input’, ‘value’ => $_POST['displayedtext']);
      update_user_meta($userID, ‘my_input’, $tempArray);

      all in all this is it, if you need more inputs you add another index in an array lets say ['type'] => ‘textarea’, and you save this in the usermeta table so that each user has his/her own value.
      Keep me posted,
      Gabriel

  13. Hello, me like you job, i use your first version plugin in local site, and pleasure)

    will be ready when the second version? I really need the user to upload their own avatar

    now I use Add-local-avatar, but i can’t integrate upload form to you plugin

    P.S. sorry my english very low

  14. Hello, Gabriel

    one problem:
    me need in right column avatar size 80px and left column avatar 40px and bio(single) 100px and comments 80px

    but get_avatar( $user_ID, 80) no work, because in option I put 40px size

    what to do to all display correctly as a gravatar?

    • Hello Vladimir,
      yes, there was a bug regarding that issue, and here is how to fix it:
      1) go to your plugins directory from your WP installation
      2) open your profile builder folder
      3) open the premium folder
      4) open the premium.functions.load.php file in an editor (like notepad, notepad++,word or something similar)
      5) there is a function called

      function changeDefaultAvatar($avatar, $id_or_email, $size, $default, $alt) {
      //...
      }

      it should look like this

      function changeDefaultAvatar($avatar, $id_or_email, $size, $default, $alt) {
        global $wpdb;
        /* Get user info. */
        global $current_user;
        get_currentuserinfo();
       
      	  $arraySettingsPresent = get_option('wppb_custom_fields','not_found');
      	  if ($arraySettingsPresent != 'not_found'){
      		$wppbFetchArray = get_option('wppb_custom_fields');
      		foreach( $wppbFetchArray as $value ){
      		  if ( $value['item_type'] == 'avatar'){
      			/* change the avatar once for everything, including the admin bar */
      			$customUserAvatar = get_user_meta((int)$current_user->id, 'custom_field_resized'.$value['id']);
      			if (($customUserAvatar[0] != '') || ($customUserAvatar[0] != null)){
      				$default = $customUserAvatar[0];
      				$avatar = "<img alt='Avatar' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$value['item_options']}' width='{$value['item_options']}' />";
      			}
      			/* next change the avatar for all the posts */
      			$customUserAvatar = get_user_meta($id_or_email->user_id, 'custom_field_resized'.$value['id']);
      			if (($customUserAvatar[0] != '') || ($customUserAvatar[0] != null)){
      				$default = $customUserAvatar[0];
      				$avatar = "<img alt='Avatar' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$value['item_options']}' width='{$value['item_options']}' />";
      			}
      		  }
      		}
      	  }
          if(!is_object($id_or_email)){ // usually $id_or_email is an object, if so, this would give a fatal error
      		$wp_user_search = $wpdb->get_results("SELECT ID FROM $wpdb->users WHERE user_email='".$id_or_email."' ORDER BY ID");
      	    foreach ( $wp_user_search as $userid ) {
      			 if ($arraySettingsPresent != 'not_found'){
      			 $wppbFetchArray = get_option('wppb_custom_fields');
      			 foreach( $wppbFetchArray as $value ){
      			   if ( $value['item_type'] == 'avatar'){
      				/* change the avatar once for everything, including the admin bar */
      				$customUserAvatar = get_user_meta((int)$userid->ID, 'custom_field_resized'.$value['id']);
      				if (($customUserAvatar[0] != '') || ($customUserAvatar[0] != null)){
      					$default = $customUserAvatar[0];
      					$avatar = "<img alt='Avatar' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$value['item_options']}' width='{$value['item_options']}' />";
      				}
      				/* next change the avatar for all the posts */
      				$customUserAvatar = get_user_meta((int)$userid->ID, 'custom_field_resized'.$value['id']);
      				if (($customUserAvatar[0] != '') || ($customUserAvatar[0] != null)){
      					$default = $customUserAvatar[0];
      					$avatar = "<img alt='Avatar' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$value['item_options']}' width='{$value['item_options']}' />";
      				}
      			  }
      			 }
      		   }
      		}
      	}
        return $avatar;
      }

      So just change copy the following code and paste it instead of the above, overwriting it:

      function changeDefaultAvatar($avatar, $id_or_email, $size, $default, $alt) {
        global $wpdb;
        /* Get user info. */
        global $current_user;
        get_currentuserinfo();
       
      	  $arraySettingsPresent = get_option('wppb_custom_fields','not_found');
      	  if ($arraySettingsPresent != 'not_found'){
      		$wppbFetchArray = get_option('wppb_custom_fields');
      		foreach( $wppbFetchArray as $value ){
      		  if ( $value['item_type'] == 'avatar'){
      			/* change the avatar once for everything, including the admin bar */
      			$customUserAvatar = get_user_meta((int)$id_or_email, 'custom_field_resized'.$value['id']);
      			if (($customUserAvatar[0] != '') || ($customUserAvatar[0] != null)){
      				$default = $customUserAvatar[0];
      				$avatar = "<img alt='$alt' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
      			}
      			/* next change the avatar for all the posts */
      			$customUserAvatar = get_user_meta($id_or_email, 'custom_field_resized'.$value['id']);
      			if (($customUserAvatar[0] != '') || ($customUserAvatar[0] != null)){
      				$default = $customUserAvatar[0];
      				$avatar = "<img alt='$alt' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
      			}
      		  }
      		}
      	  }
          if(!is_object($id_or_email)){ // usually $id_or_email is an object, if so, this would give a fatal error
      		$wp_user_search = $wpdb->get_results("SELECT ID FROM $wpdb->users WHERE user_email='".$id_or_email."' ORDER BY ID");
      	    foreach ( $wp_user_search as $userid ) {
      			 if ($arraySettingsPresent != 'not_found'){
      			 $wppbFetchArray = get_option('wppb_custom_fields');
      			 foreach( $wppbFetchArray as $value ){
      			   if ( $value['item_type'] == 'avatar'){
      				/* change the avatar once for everything, including the admin bar */
      				$customUserAvatar = get_user_meta((int)$userid->ID, 'custom_field_resized'.$value['id']);
      				if (($customUserAvatar[0] != '') || ($customUserAvatar[0] != null)){
      					$default = $customUserAvatar[0];
      					$avatar = "<img alt='$alt' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
      				}
      				/* next change the avatar for all the posts */
      				$customUserAvatar = get_user_meta((int)$userid->ID, 'custom_field_resized'.$value['id']);
      				if (($customUserAvatar[0] != '') || ($customUserAvatar[0] != null)){
      					$default = $customUserAvatar[0];
      					$avatar = "<img alt='$alt' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
      				}
      			  }
      			 }
      		   }
      		}
      	}
        return $avatar;
      }

      If you need any more help, let me know,
      Gabriel

  15. Hi mate,

    Absolutely love the plugin and am currently testing the beta version. I’ve just filled out the survey and mentioned a couple of features that are kind of must haves for me and they should also be pretty easy to implement.

    However, one of them is kind of a necessity for me right now so I wonder if you could give me the code for it as I’m sure it is extremely simple yet I have very little in the way of PHP experience in order to work out the required code myself.

    I need to be able to redirect to page of my choice upon registration. Is there any way I can do this by adding a couple of lines of code into the beta versions php files?

    Also – The ability to have different fields on the registration and edit profile pages is a must have for me. I’m looking forward to seeing how this plugin develops. Keep up the great work!

    • Hello Gordon,
      in the plugin_folder/front-end/wppb.register.php you will see something like this (among other) somewhere right at the beginning:

      /* If user registered, input info. */
      	if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'adduser' && wp_verify_nonce($_POST['register_nonce_field'],'verify_true_registration') ) {
       
      		$user_pass = esc_attr( $_POST['passw1'] );
      		$userdata = array(
      			'user_pass' => $user_pass,
      			'user_login' => esc_attr( $_POST['user_name'] ),
      			'first_name' => esc_attr( $_POST['first_name'] ),
      			'last_name' => esc_attr( $_POST['last_name'] ),
      			'nickname' => esc_attr( $_POST['nickname'] ),
      			'user_email' => esc_attr( $_POST['email'] ),
      			'user_url' => esc_attr( $_POST['website'] ),
      			'aim' => esc_attr( $_POST['aim'] ),
      			'yim' => esc_attr( $_POST['yim'] ),
      			'jabber' => esc_attr( $_POST['jabber'] ),
      			'description' => esc_attr( $_POST['description'] ),
      			'role' => get_option( 'default_role' ),
      		);
       
      		if ( !$userdata['user_login'] )
      			$error = __('A username is required for registration.', 'profilebuilder');
      		elseif ( username_exists($userdata['user_login']) )
      			$error = __('Sorry, that username already exists!', 'profilebuilder');
       
      		elseif ( !is_email($userdata['user_email'], true) )
      			$error = __('You must enter a valid email address.', 'profilebuilder');
      		elseif ( email_exists($userdata['user_email']) )
      			$error = __('Sorry, that email address is already used!', 'profilebuilder');
      		elseif (( empty($_POST['passw1'] ) || empty( $_POST['passw2'] )) || ( $_POST['pass1'] != $_POST['pass2'] )){
      				if ( empty($_POST['passw1'] ) || empty( $_POST['passw2'] ))                                                    //verify if the user has completed both password fields
      					$error = __('You didn\'t complete one of the password-fields!', 'profilebuilder');
      				elseif ( $_POST['pass1'] != $_POST['pass2'] )																   //verify if the the password and the retyped password are a match
      					$error = __('The entered passwords don\'t match!', 'profilebuilder');
      			}
       
      		else{
      			$registered_name = $_POST['user_name'];
      			$new_user = wp_insert_user( $userdata );
       
      			/* add the extra profile information */
      			$wppb_premium = wppb_plugin_dir . '/premium/functions/';
      			if (file_exists ( $wppb_premium.'extra.fields.php' )){
      				$wppbFetchArray = get_option('wppb_custom_fields');
      				foreach ( $wppbFetchArray as $key => $value){
      					switch ($value['item_type']) {
      						case "input":{
      							add_user_meta( $new_user, 'custom_field_'.$value['id'], esc_attr($_POST[$value['item_id'].$value['id']]) );
      							break;
      						}
      						case "checkbox":{
      							$checkboxOption = '';
      							$checkboxValue = explode(',', $value['item_options']);
      							foreach($checkboxValue as $thisValue){
      								if (isset($_POST[$thisValue.$value['id']]))
      									$checkboxOption = $checkboxOption.$_POST[$thisValue.$value['id']].',';
      							}
      							add_user_meta( $new_user, 'custom_field_'.$value['id'], $checkboxOption );
      							break;
      						}
      						case "radio":{
      							add_user_meta( $new_user, 'custom_field_'.$value['id'], $_POST[$value['item_id'].$value['id']] );
      							break;
      						}
      						case "select":{
      							add_user_meta( $new_user, 'custom_field_'.$value['id'], $_POST[$value['item_id'].$value['id']] );
      							break;
      						}
      						case "textarea":{
      							add_user_meta( $new_user, 'custom_field_'.$value['id'], esc_attr($_POST[$value['item_id'].$value['id']]) );
      							break;
      						}
      						case "upload":{
      							$uploadedfile = $value['item_type'].$value['id'];
      							$target_path = "wp-content/uploads/profile_builder/attachments/";
       
      							$target_path = $target_path . 'userID_'.$new_user.'_attachment_'. basename( $_FILES[$uploadedfile]['name']); 	
       
      							if (move_uploaded_file($_FILES[$uploadedfile]['tmp_name'], $target_path)){
      								$upFile = get_bloginfo('home').'/'.$target_path;
      								add_user_meta( $new_user, 'custom_field_'.$value['id'], $upFile );
      							}
      							break;
      						}
      						case "avatar":{
       
      							$uploadedfile = $value['item_type'].$value['id'];
      							$target_path_original = "wp-content/uploads/profile_builder/avatars/";
       
      							$target_path = $target_path_original . 'userID_'.$new_user.'_originalAvatar_'. basename( $_FILES[$uploadedfile]['name']); 	
       
      							/* when trying to upload file, be sure it's one of the accepted image file-types */
      							if (($_FILES[$uploadedfile]['type'] == 'image/jpeg') || ($_FILES[$uploadedfile]['type'] == 'image/jpg') || ($_FILES[$uploadedfile]['type'] == 'image/png') || ($_FILES[$uploadedfile]['type'] == 'image/bmp')){
      								$wp_filetype = wp_check_filetype(basename( $_FILES[$uploadedfile]['name']), null );
      								$attachment = array('post_mime_type' => $wp_filetype['type'],
      													'post_title' => preg_replace('/\.[^.]+$/', '', basename($_FILES[$uploadedfile]['name'])),
      													'post_content' => '',
      													'post_status' => 'inherit'
      													);
       
       
      								$attach_id = wp_insert_attachment( $attachment, $target_path);
       
      								$upFile = image_downsize( $attach_id, 'thumbnail' );
      								$upFile = $upFile[0];
       
      								//if file upload succeded			
      								if (move_uploaded_file($_FILES[$uploadedfile]['tmp_name'], $target_path)){
      									add_user_meta( $new_user, 'custom_field_'.$value['id'], $upFile );
      									$avatarUpload = 'yes';
      								}
      								else $avatarUpload = 'no'; 
      							}
      							if (($_FILES[$uploadedfile]['type'] == ''))
      								$avatarUpload = 'yes';
       
      							break;
      						}
      					}
      				}
      			}
       
       
       
       
      			if (isset($_POST['send_credentials_via_email']) && ($_POST['send_credentials_via_email'] == 'sending')){
      				$email = $_POST['email'];                                 //change these variables to modify sent email message, destination and source.
      				$fromemail = get_bloginfo('name');
      				$mailPassword = $_POST['passw1'];
      				$mailUsername = $_POST['user_name'];
      				$subject = 'A new account has been created for you.';
      				$msg = 'Welcome to blog '.$fromemail.'. Your username is:'.$mailUsername.' and password:'.$mailPassword;
      				$messageSent = wp_mail( $email, $subject, $msg);
      				if( $messageSent == TRUE)
      					$sentEmailStatus = 2;
      				else
      					$sentEmailStatus = 1;
      			}
       
      		}
       
            // INSERT REDIRECT HERE
      	}

      All you need to do is do a redirect request right before the last bracket (I added the following comment: “//INSERT REDIRECT HERE”) . There you must either do a php redirect (use header() function) or the wordpress redirect ( wp_redirect() ).
      Hope this helps,
      Gabriel

  16. Hi – I’m also having the problem with an avatar added by ANYONE (admin or user) showing up as the avatar for all users. Also, when trying to delete the photo from the [wppb-edit-profile] page, I get a 404 error, although the avatar was deleted when I checked my profile from wp-admin.

    I’ve deleted the photo from both wp-admin profile page and [wppb-edit-profile], as both admin and test user without admin privileges. So in principle, it shouldn’t be anywhere on the site any more. Except that it’s still showing up all over the place, associated with each user… Clearing my cache hasn’t done a thing. Hm. It’s quite an ego trip, seeing my face on every single comment and post!

    • Hello Bonnie,
      indeed the avatar had a little bug, which was hidden till one of our beta testers reported it to us and we fixed it. If you signed up for the beta version, you should’ve received by now a fixed (final) version of Profile Builder and if you decide to buy it, you can get a 50% discount. For more information, read up on cozmoslabs.com

      • Well, I deleted the old version and uploaded the new one (in the process of course losing all of my fields) and created a new avatar field. I uploaded a picture.

        I STILL get a picture of myself on every comment. I will have to play more this evening, but at the moment the only thing I can see that has changed is that the avatar size is smaller (which is great.)

        • Also, when I use the front end page to add the avatar, it doesn’t show as having been uploaded in the dashboard profile page.

        • Regarding your second issue: I have tried it out right now, and it DOES change in the back end

        • As I said, I’ll have to play some more – I have to leave in a few minutes. Perhaps it’s just an issue of clearing the cache, but for the moment, I’m having the same problems as before… (Firefox and Safari) I should probably remind you that I’m using WordPress 3.2, and in fact am getting the bleeding nightlies…

        • We found the issue, here is the modifications you will need to make in order to fix it on your version:
          Change this version

          function changeDefaultAvatar($avatar, $id_or_email, $size, $default, $alt) {
            global $wpdb;
            /* Get user info. */
            global $current_user;
            get_currentuserinfo();
           
          	  $arraySettingsPresent = get_option('wppb_custom_fields','not_found');
          	  if ($arraySettingsPresent != 'not_found'){
          		$wppbFetchArray = get_option('wppb_custom_fields');
          		foreach( $wppbFetchArray as $value ){
          		  if ( $value['item_type'] == 'avatar'){
          			/* change the avatar once for everything, including the admin bar */
          			$customUserAvatar = get_user_meta((int)$current_user->id, 'custom_field_resized'.$value['id'], true);
          			if (($customUserAvatar != '') || ($customUserAvatar != null)){
          				$default = $customUserAvatar;
          				$avatar = "<img alt='$alt' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
          			}
          			/* next change the avatar for all the posts */
          			if(is_object($id_or_email)){
          				$customUserAvatar = get_user_meta($id_or_email->user_id, 'custom_field_resized'.$value['id'], true);
          				if (($customUserAvatar != '') || ($customUserAvatar != null)){
          					$default = $customUserAvatar;
          					$avatar = "<img alt='$alt' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
          				}
          			}
          		  }
          		}
          	  }
              if(!is_object($id_or_email)){ // usually $id_or_email is an object, if so, this would give a fatal error
          		$wp_user_search = $wpdb->get_results("SELECT ID FROM $wpdb->users WHERE user_email='".$id_or_email."' ORDER BY ID");
          	    foreach ( $wp_user_search as $userid ) {
          			 if ($arraySettingsPresent != 'not_found'){
          			 $wppbFetchArray = get_option('wppb_custom_fields');
          			 foreach( $wppbFetchArray as $value ){
          			   if ( $value['item_type'] == 'avatar'){
          				/* change the avatar once for everything, including the admin bar */
          				$customUserAvatar = get_user_meta((int)$userid->ID, 'custom_field_resized'.$value['id']);
          				if (($customUserAvatar[0] != '') || ($customUserAvatar[0] != null)){
          					$default = $customUserAvatar[0];
          					$avatar = "<img alt='$alt' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
          				}
          				/* next change the avatar for all the posts */
          				$customUserAvatar = get_user_meta((int)$userid->ID, 'custom_field_resized'.$value['id']);
          				if (($customUserAvatar[0] != '') || ($customUserAvatar[0] != null)){
          					$default = $customUserAvatar[0];
          					$avatar = "<img alt='$alt' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
          				}
          			  }
          			 }
          		   }
          		}
          	}
            return $avatar;
          }

          to the following:

          function changeDefaultAvatar($avatar, $id_or_email, $size, $default, $alt) {
            global $wpdb;
            /* Get user info. */
            global $current_user;
            get_currentuserinfo();
           
          	  $arraySettingsPresent = get_option('wppb_custom_fields','not_found');
          	  if ($arraySettingsPresent != 'not_found'){
          		$wppbFetchArray = get_option('wppb_custom_fields');
          		foreach( $wppbFetchArray as $value ){
          		  if ( $value['item_type'] == 'avatar'){
          			/* change the avatar once for everything, including the admin bar */
          			$customUserAvatar = get_user_meta($id_or_email->user_id, 'custom_field_resized'.$value['id'], true);
          			if (($customUserAvatar != '') || ($customUserAvatar != null)){
          				$default = $customUserAvatar;
          				$avatar = "<img alt='$alt' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
          			}
          			/* next change the avatar for all the posts */
          			if(is_object($id_or_email)){
          				$customUserAvatar = get_user_meta($id_or_email->user_id, 'custom_field_resized'.$value['id'], true);
          				if (($customUserAvatar != '') || ($customUserAvatar != null)){
          					$default = $customUserAvatar;
          					$avatar = "<img alt='$alt' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
          				}
          			}
          		  }
          		}
          	  }
              if(!is_object($id_or_email)){ // usually $id_or_email is an object, if so, this would give a fatal error
          		$wp_user_search = $wpdb->get_results("SELECT ID FROM $wpdb->users WHERE user_email='".$id_or_email."' ORDER BY ID");
          	    foreach ( $wp_user_search as $userid ) {
          			 if ($arraySettingsPresent != 'not_found'){
          			 $wppbFetchArray = get_option('wppb_custom_fields');
          			 foreach( $wppbFetchArray as $value ){
          			   if ( $value['item_type'] == 'avatar'){
          				/* change the avatar once for everything, including the admin bar */
          				$customUserAvatar = get_user_meta((int)$userid->ID, 'custom_field_resized'.$value['id']);
          				if (($customUserAvatar[0] != '') || ($customUserAvatar[0] != null)){
          					$default = $customUserAvatar[0];
          					$avatar = "<img alt='$alt' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
          				}
          				/* next change the avatar for all the posts */
          				$customUserAvatar = get_user_meta((int)$userid->ID, 'custom_field_resized'.$value['id']);
          				if (($customUserAvatar[0] != '') || ($customUserAvatar[0] != null)){
          					$default = $customUserAvatar[0];
          					$avatar = "<img alt='$alt' src='{$default}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
          				}
          			  }
          			 }
          		   }
          		}
          	}
            return $avatar;
          }

          in plugin_dir/premium/functions/premium.functions.load.php

  17. Hi, I think I am going to take a seconc look at this plugin.
    The basic/free verison kind of does what I want. What I’d like to know is I am using it on a multisite installation. If I create extra fields in the pro verison will these extra populated fields be visible, in the users profile in the network admin area? I have tested it with the standard fields and these are passed over.

    Also I am currently using a them my login and register plus redux. Would this plug cover what those two do?

    many thanks

    • Hi Richard,

      WordPress users are installation wide. That means a user registered on the main site can also login on a sub-site.

      So if you put the login, register and edit-profile in pages on the main site and link to those pages from all sub-sites everything will work ok.

      However, our plugin dose not take care of registration of new blogs and only manages subscribers.

      Can you tell me a bit more about your project and what exactly you want to achieve with our plugin. That way I’ll be able to tell you if you should use our plugin or not.

  18. Hi,

    Whenever I try to register a new User it tells me:

    Sorry, that username already exists!

    In the WP backend I can see that the user was created. The “register” page still tells me that whatever i input.. => Sorry, that username already exists!

    • Hello Jan,

      either deactivate simple fb connect if you have it, OR the reason is that your page reloads twice very fast. So the first time in loads it creates the user, and then the second time you get the given error.

      Let me know which one is it

        • Talk with your admin/provider and tell him this because it is not from PB. We had this problem 1-2 times before, and it was always the server’s fault, that it reloaded the pages 2 times very fast (and sometimes giving faulty errors because of this).

  19. Hi

    hopefully you can help with what i hope are basic queries…..

    i have the free version installed on WP3.3.1. and having read the faq and readme, i have the following issues:

    1) on the PB settings page / Plugin Layout, i am unable to change the stylesheet from default to none?

    2) on the PB settings page /show/Hide the Admin Bar on Front End, i am unable to change the default visibility from show to hide

    I can make the selections but once i click “save changes” the form reverts to its default values.

    3) how do i change it from the default “only administrators can create new users”?

    Many thanks

    Mark

  20. Hello Gabriel.

    Love the plugin. Am having one issue with the avatar display – perhaps you can help me. I’ve set up an ‘avatar’ extra field in the wp-admin back end with a size of 75×75 px, and I’m displaying the avatar image on the front end like so:

    $profile_pic = get_the_author_meta(‘avatar_picture’, $user->ID);

    (obviously there’s lots of other stuff going on, but those are the relevant avatar lines of code). The problem is, this just gives me the original full-size image, not the 75×75 img i want. Right now the sizes are being adjusted with css, but this isn’t ideal.

    also, I’ve tried using get_avatar() in various ways, but to no avail. the plugin site says it has automatic integration with themes using get_avatar(). what does that mean exactly?

    Thanks in advance!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>