Registration Using Advanced Custom Fields

This topic contains 1 reply, has 2 voices, and was last updated by  easyregistrationadmin 9 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1480

    cbcolvard
    Participant

    What has to be included in the registration form (all inputs under advanced as well) to redirect to a page using roles (Members) and then display the page content based on that user? So, this is a custom registered user page where I want to display anything from the registration form (similar to an account page) specific to that user and role, but also customize that page with all standard fields and custom fields from Advanced Custom Fields meta.

    1. How to make this dynamic page? Please include all the syntax I would use as I am not an advanced developer.

    2. How would I have links or buttons on this new member page that has new forms (made with Advanced Custom Fields) associated with that user ID?

    3. How do I make sure the login form goes to this new member page and shows all the data as described above? Is there a code to put in the redirection for the member role redirect link?

    I think if I can get the basics I can get it done.

    Thank you very much!

    Chris Colvard

    #1517

    Hi there,

    Happy New Year!!. Apologies for the delayed response due to New Year vacations. Please find your answers below:
    1. Dynamic Page: There is no such configuration to achieve it. However it can be accomplished using our filters. I am not sure how much you are aware about the filters but they provide a mechanism to extend the behaviour of plugin without touching the core. Here is the official documentation: https://developer.wordpress.org/plugins/hooks/filters/
    Here are the steps:
    1. Add our filter in your theme’s functions.php. Here is the code : add_filter(‘erf_ajax_before_sub_response’,’after_sub_redirection’);
    2. In the above filter ‘after_sub_redirection’ is name of the function which will be called just before sending the response after submission.
    3. Add the function body next to the filter line :
    function after_sub_redirection($response){
    // Custom logic
    $response[‘redirect_to’]=’https://xyz.com’;
    return $response;
    }
    4. Above function has one argument $response. This is an array and includes other useful data. One of the important information is Submission ID. You can access it using $response[‘submission_id’] within the above callback function.
    5. Within your function, you can load the submission data using: $submission= erforms()->submission->get_submission($response[‘submission_id’]);
    6. Above submission object has user information (If Registration Form). You can access it from $submission[‘user’]. Now you can implement your redirection logic on the basis of user role.

    2. Links and Buttons on new Member page: On the new page you can use our shortcode [erforms_my_account], This will show all the information related to the logged in user. (*Note: Information is visible only when user is logged in.). You can change this template and can customise it to hold your advance custom field meta. To override the template you have to a new filter in theme’s functions.php :
    1.add_filter(‘erf_my_account_template’,’my_account_custom_template’);
    2. Add the function :
    function my_account_custom_template($template){
    // Change the template path here
    return new_template_path;
    }
    3. Role based redirection after login: This can be configured from Global Settings->Login Options->Enable Role Based Redirection

    Let us know if you have any issues.

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

You must be logged in to reply to this topic.