Results 1 to 5 of 5

Thread: Need help making modification to user widget content..

  1. #1
    Thread Starter
    jobortunity's Avatar
    Join Date
    Oct 2011
    Location
    Kitchener, Ontario
    Posts
    153
    Thanks
    11
    Thanked 11 Times in 9 Posts

    Need help making modification to user widget content..

    Just wondering if anyone can help me with this small snag..

    I wanted to add an extra user identifier in the users dashboard account info widget.

    Here's the original widget code:

    Code:
    	<div class="widget_content">
    		<ul>
    			<li><strong><?php _e('Username:','appthemes')?></strong> <?php echo $userdata->user_login; ?></li>
    			<li><strong><?php _e('Account type:','appthemes')?></strong> <?php
    				$user = new WP_User( $userdata->ID );
    				if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
    					foreach ( $user->roles as $role )
    						if ($role=='job_seeker') echo __('Job Seeker', 'appthemes');
    						else echo __('Job Lister', 'appthemes');
    				}
    			?></li>
    			<li><strong><?php _e('Member Since:','appthemes')?></strong> <?php appthemes_get_reg_date($userdata->user_registered); ?></li>
    			<li><strong><?php _e('Last Login:','appthemes'); ?></strong> <?php appthemes_get_last_login($userdata->ID); ?></li>
    		</ul>
    	</div>

    Here's the modified widget code:

    Code:
    	<div class="widget_content">
    		<ul>
    			<li><strong><?php _e('Username:','appthemes')?></strong> <?php echo $userdata->user_login; ?></li>
    			<li><strong><?php _e('Account type:','appthemes')?></strong> <?php
    				$user = new WP_User( $userdata->ID );
    				if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
    					foreach ( $user->roles as $role )
    						if ($role=='job_seeker') echo __('Job Seeker', 'appthemes');
    						if ($role=='recruiter') echo __('Recruiter', 'appthemes');
    						else echo __('Job Lister', 'appthemes');
    				}
    			?></li>
    			<li><strong><?php _e('Member Since:','appthemes')?></strong> <?php appthemes_get_reg_date($userdata->user_registered); ?></li>
    			<li><strong><?php _e('Last Login:','appthemes'); ?></strong> <?php appthemes_get_last_login($userdata->ID); ?></li>
    		</ul>
    	</div>
    I need to add Recruiter to the list, and so I added the extra if statement to the list. Now this method worked, and when a Recruiter signs in it displays Account type: Recruiter, same goes for Job Lister, but one small snag happened for Job Seekers. When a regular job seeker signs in to dashboard, they get Job Account Type: SeekerJob Lister displayed on the widget. Where did I go wrong, and how can I fix this so it works properly.

    Thanks in advance, and your help is appreciated.

  2. #2
    Thread Starter
    jobortunity's Avatar
    Join Date
    Oct 2011
    Location
    Kitchener, Ontario
    Posts
    153
    Thanks
    11
    Thanked 11 Times in 9 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. #3
    thebaht's Avatar
    Join Date
    Jan 2012
    Posts
    56
    Thanks
    8
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  4. #4
    Senior Member gr8job's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    108
    Thanks
    16
    Thanked 5 Times in 4 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #5
    Thread Starter
    jobortunity's Avatar
    Join Date
    Oct 2011
    Location
    Kitchener, Ontario
    Posts
    153
    Thanks
    11
    Thanked 11 Times in 9 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Editing page width (content and widget area)
    By naturalrabbitfood in forum ClassiPress General Discussion
    Replies: 0
    Last Post: January 11th, 2012, 08:59 AM
  2. Widget replacing existing content on main side bar
    By louie in forum Report ClassiPress Bugs
    Replies: 3
    Last Post: March 13th, 2011, 09:35 PM
  3. Unable to locate WordPress Content directory (wp-content).
    By anutka in forum WordPress General Discussion
    Replies: 2
    Last Post: February 15th, 2011, 10:35 AM