WordPress.org

Ready to get started?Download WordPress

Forums

Form Manager
Suggested Improvement: Different link from main page when using Members plugin (2 posts)

  1. jonmase
    Member
    Posted 1 year ago #

    Hi,

    I've been playing with the (fantastic) form manager plugin for a while, and have just added Justin Talbot's Members plugin. Its great that the form manager plugin integrates with this - thank you hoffcamp!

    One little improvement that I've just made is to alter the link from the form name on main.php, so that if someone is not allowed to edit forms, but is allowed to view the data, clicking on the form name takes them straight to the "Submission Data" page. Currently, if a user who is not allowed to edit forms clicks on the form name, they are taken to a blank page with just the "Submission Data" tab, which they then have to click on to see the data.

    I fixed this by changing line 155 in pages/main.php to:

    <a class="row-title" href="<?php
    if(!$fm_MEMBERS_EXISTS || current_user_can('form_manager_forms')) {
    echo get_admin_url(null, 'admin.php')."?page=fm-edit-form&sec=design&id=".$form['ID'];
    }
    else if(current_user_can('form_manager_data')) {
    echo get_admin_url(null, 'admin.php')."?page=fm-edit-form&sec=data&id=".$form['ID'];
    } ?>">
    <?php echo $form['title'];?>

    Cheers,

    Jon

    http://wordpress.org/extend/plugins/wordpress-form-manager/

  2. jonmase
    Member
    Posted 1 year ago #

    It would be even better to use the code snippet below, so that if the Members plugin is installed and the user has the 'form_manager_main' capability so can see the list of forms, but can't actually do anything to those forms (i.e. doesn't have either 'form_manager_forms' or 'form_manager_data'), then the form name isn't made into a link. I'm not sure why a user would have that combination of capabilities, as there's no point giving them 'form_manager_main' if they can't do anything with the forms, but it makes it a bit more robust.

    <strong>
       <?php if(!$fm_MEMBERS_EXISTS || current_user_can('form_manager_forms') || current_user_can('form_manager_data')) { ?>
          <a class="row-title" href="<?php
          if(!$fm_MEMBERS_EXISTS || current_user_can('form_manager_forms')) {
             echo get_admin_url(null, 'admin.php')."?page=fm-edit-form&sec=design&id=".$form['ID'];
          }
          else if(current_user_can('form_manager_data')) {
             echo get_admin_url(null, 'admin.php')."?page=fm-edit-form&sec=data&id=".$form['ID'];
          }
       ?>">
       <?php echo $form['title'];?></a>
       <?php } else { echo $form['title']; } //If user has no form permissions, do not create a link ?>
    </strong>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic