Home Forums Plugin Support WP User Frontend Pro Guest Post Auto user registration Roles

This topic is: not resolved

This topic contains 2 replies, has 3 voices, and was last updated by  Sekander Badsha 4 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #28997

    V
    Member
    Post count: 4

    Hello,

    I am using WPUF PRO. I know there is a setting to define the user role on a registration form, but there is no option to define the user role on a post form, (with guest post and auto user registration).

    I have read these forum topics:
    http://wedevs.com/support/topic/choose-user-type-on-registration/#post-2403
    and
    http://wedevs.com/support/topic/change-user-role-on-registration/

    But I want to define the user role without using a value from a custom field. I want to define the user role based on the post type being created (or based on the form ID being used, because I have one form for each post type)

    I tried something like:

    function wpufe_my_switch_reg( $args ) {

    if ( $_POST[‘post_type'] == ‘house' ) {
    $args[‘role'] = ‘subscriber';
    } elseif ( $_POST[‘post_type'] == ‘hotel' ) {
    $args[‘role'] = ‘editor';
    }

    return $args;
    }

    add_filter( ‘wpuf_register_user_args', ‘wpufe_my_switch_reg' );

    But it's not working. Any help would be very much appreciated.

    Many thanks

    #29074

    Nayem
    Moderator
    Post count: 6480

    Hello V,

    I need to discuss with our developer team about this. Please allow me some time.

    Thank you ๐Ÿ™‚

    #29372

    Sekander Badsha
    Member
    Post count: 2067

    Hello V,

    They way your are trying is not correct. Only email or name can not register a user. To register an user, there is some must have some required fields. To get a idea about what parameters to pass, open up class/frontend-form-profile.php and go to line number 222. You will get idea about what to write.

    Thank you ๐Ÿ™‚

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Guest Post Auto user registration Roles’ is closed to new replies.