Alex Howes

Forum Replies Created

Viewing 12 posts - 16 through 27 (of 27 total)
  • Author
    Posts
  • in reply to: GD reviews in profile not displaying correctly #2330

    Alex Howes
    Buyer
    Post count: 175
    This reply has been marked as private.
    in reply to: Logout not working #2329

    Alex Howes
    Buyer
    Post count: 175

    Thanks for your reply 🙂

    It’s a really weird problem- it’s now doing different things. Before the problem started I used the logout page https://www.barn-door.co.uk/logout which didn’t go to the WP “do you wish to logout page?” but did log the user out.

    When that stopped working I also tried creating a page with URL http://barn-door.co.uk/wp-login.php?action=logout.

    Sometimes https://www.barn-door.co.uk/logout works, but sometimes not. The other, http://barn-door.co.uk/wp-login.php?action=logout, either goes to the WP admin login page, or to the home page.

    Neither is currently redirecting to the “about” page set in usersWP, either for logged in or logged out users.

    in reply to: Logout not working #2326

    Alex Howes
    Buyer
    Post count: 175

    In investigating this problem, I set the usersWP logout redirect page to another page, say the “about” page, to see what happened. The results were odd.

    If I try to logout when logged in, the logout page doesn’t logout and still redirects to the home page (rather than the “about” page I set it to).
    If I go to the logout page when logged out, I see the correct WP “are you sure you wish to logout?” page, and then it redirects correctly to the “about” page, as set in usersWP.

    Not sure whether this comes from a usersWP issue or not. Any ideas would be much appreciated!

    in reply to: Logout not working #2317

    Alex Howes
    Buyer
    Post count: 175

    Oh, sorry, ok. It must be a wordpress problem then. I’ll ask in the WordPress support forum.

    in reply to: Login redirect to last user page #2286

    Alex Howes
    Buyer
    Post count: 175

    Cool, thanks for your help 🙂

    in reply to: Login redirect to last user page #2279

    Alex Howes
    Buyer
    Post count: 175

    Possibly just checking whether the last user page exists or not would work. If it exists, then redirect there after login, and if not then redirect to the home page. Do you know if there’s an action or filter that gets run that does the redirection? That way I could write a snippet to hook to it.

    in reply to: Login redirect to last user page #2277

    Alex Howes
    Buyer
    Post count: 175

    Hi Patrik,

    I think this is a usersWP bug rather than something specific to my site. Maybe I didn’t explain properly.

    When the option “Last User Page” is selected as the login redirect page, the user sometimes gets redirected to a blank page. This happens if the user’s last page was not on my site, or doesn’t exist (e.g. it’s the first page of a new window). Is it possible to set a fallback option, so that if the users’s last page doesn’t exist it redirects to home?

    Thanks
    Alex

    in reply to: Getting post user data #2275

    Alex Howes
    Buyer
    Post count: 175

    Great, thanks! 🙂

    in reply to: Getting post user data #2267

    Alex Howes
    Buyer
    Post count: 175

    Great, thanks. Is there a way to get a specific field from the user meta? And is there a function that I can use to change the user meta?

    Thanks for your help!
    Alex

    in reply to: Hook to remove tabs on profile depending on user role #2214

    Alex Howes
    Buyer
    Post count: 175

    Thanks for the pointer, I’ve got it working now 🙂

    Alex

    in reply to: Select role from register page #2149

    Alex Howes
    Buyer
    Post count: 175

    Thanks Patrik

    It’s now working 🙂 In case anyone else on here is interested in doing this, I’ve written my code below. The html variable name for the role field is ‘role’ which must be prefixed by ‘uwp_account_’. The two options it can take on my form are ‘Worker’ and ‘Employer’ which correspond to my two roles ‘um_worker’ and ’employer’.

    
    
    add_action('uwp_after_custom_fields_save', 'assign_user_role_on_registration', 10, 4);
    
    function assign_user_role_on_registration( $form_type, $data, $result, $user_id ) {
      
      if ($form_type == 'register') {
    	
            $role = $data['uwp_account_role'];	
    		$current_user = get_userdata($user_id);
    	    
    	    if ($current_user) {
    	
    			$current_user_roles = $current_user->roles;
    	
    			if (in_array('subscriber', $current_user_roles)) {
    		  
    		  		if ($role == 'Worker') {
    	  
    	  				$current_user->set_role( 'um_worker' );	
    		    	}
    		  
    		  		if ($role == 'Employer') {
    		   
    		    		$current_user->set_role( 'employer' );			  
    		    	}
      	  		 }
    	   }
      }
    }
    in reply to: Select role from register page #2141

    Alex Howes
    Buyer
    Post count: 175

    My current code is:

    add_filter(‘hook’, ‘assign_user_role_on_registration’);

    function assign_user_role_on_registration( $data ) {

    global $post;
    $post_id = $post->ID;

    if ($post_id) {
    $role = geodir_get_post_meta($post_id, ‘role’);

    $current_user = wp_get_current_user();
    $current_user_roles = $current_user->roles;

    if (in_array(‘subscriber’, $current_user_roles)){

    $current_user->set_role( $role );

    }
    }
    return $data;
    }

    Where hook is the relevant hook (not sure what this is). I’m also not sure if geodir_get_post_meta is the right way to access the form field.

Viewing 12 posts - 16 through 27 (of 27 total)