• Hi, Sir, I have 5 fields that will be displayed on my list.But for search, i just want to restrict user that he can only search using one field that is “Surname of Interest” so can you please guide is there any shortcode to control on the search filter
    Thanks

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author xnau webdesign

    (@xnau)

    Thread Starter jamshaid32

    (@jamshaid32)

    Thanks for you Help I have fixed it. I love the plugins
    can you please help me in another issue as well

    I want that the first field “Membership ID” will be auto picked from system username. I have to get the username through PHP code but do not know How to parse it to my first field
    https://www.bradfordfhs.org.uk/members-interests/add-interest/

    Plugin Author xnau webdesign

    (@xnau)

    There are two ways of doing this, the first is to use the pdb-before_submit_signup filter to set the value before the record is saved. In this case, you need to include that field as a hidden field because it’s not possible to just add a field at that point, it has to be included in the form.

    The second (and preferred) way to do this is to use the pdb-after_submit_signup action to set your field value after the new record is saved. In this case, you need to write the field value in a separate operation using Participants_Db::write_participant($data,$id)

    Thread Starter jamshaid32

    (@jamshaid32)

    Hi Thanks for your response . can you please gave me an example of code
    I have tried but failed every time. I am very happy if you can help me
    Thanks

    Thread Starter jamshaid32

    (@jamshaid32)

    Here How i Add a 1 as a sample

    add_action(‘pdb-after_submit_signup’, ‘assign_id’);
    function assign_id($data,$id) {
    $data = “5003” ;
    $id = “membership_id” ;

    Participants_Db::write_participant($data,$id);
    }

    Plugin Author xnau webdesign

    (@xnau)

    The $data argument of the Participants_Db::write_participant method must be an array that names the field and the data to put in that field. The $id part must be the ID of the record you want to place the value in.

    So… something like this:

    add_action(‘pdb-after_submit_signup’, ‘assign_id’);
    
    function assign_id( $data, $id ) {
    
       $data = array( 'membership_id' => '5003' );
       Participants_Db::write_participant( $data, $id );
    }
    Thread Starter jamshaid32

    (@jamshaid32)

    its not working for me
    can you please guide me what will be the id in that case
    is that one is the record id ?

    Plugin Author xnau webdesign

    (@xnau)

    I can’t tell you how to do that, but that function is the place to do it. For instance, if you wanted to use some other values from the data array to create your ID number, you’d put the code to do that in that function. The $data variable (before it gets assigned) has all the submitted values from the signup form.

    Thread Starter jamshaid32

    (@jamshaid32)

    okay, i got it. Thanks
    so should i displayed these field in sign up forms . i just only want membership id from system else will be from user signup forms.
    i tired now its working but when i submit data two record added in db

    Plugin Author xnau webdesign

    (@xnau)

    Make sure that the second argument to the write_participant method is the same $id as supplied to the function. That $id is the id of the new record. If you change that, the write_participant function will create a new record.

    Thread Starter jamshaid32

    (@jamshaid32)

    Okay, so can I get that id value from the plugin last register record.
    Actually what I want that user will fill 4 fields from signup forms while 1 field that will be the membership id of that login users should be picked up from the system.
    So that every one can add the record against his own username not using any other usernames.

    Plugin Author xnau webdesign

    (@xnau)

    If I understand you correctly, if you want your users to come up with a unique username, you can enforce that with the duplicate record settings in the Signup Form settings.

    If you want to automatically assign this value, you need to write a bit of code that sets the value in the background when the signup is submitted…you can then give them the ID in the feedback message or the email.

    You would use the ‘pdb-before_submit_signup‘ filter, which gives you access to the posted data from the form. If you include the ID field as a hidden field, you can use your filter callback to insert your unique value.

    Thread Starter jamshaid32

    (@jamshaid32)

    No you have not get it right
    Here what i need
    I want to keep a record of user interest in the website . one user may have more than 1 interest so he can add more than 1 record
    The issue is that while adding record user have to enter its membership id that is his username along with other 4 fields. So it is a possibility that a user can use any other person id/username and can add record along with his membership Id while I just want to restrict user that he can only add record against his own id. So for that, i just want that when a user enters its record instead of asking that id from the user. my system will automatically add the membership id that can get from current login user->username.

    InShort while adding a record from page User will fill all others 4 fields but the membership id will be picked from his username and total of 5 fields should be submitted in record

    I hope you got it Now

    Plugin Author xnau webdesign

    (@xnau)

    So, my previous answer gives you how to do this: set up a filter that places the membership ID value in the value of a hidden field when the new record is submitted.

    Alternatively, you can do this in a custom template: set the value of the “membership_id” hidden field in the template. You can do this by adding something like this at the top of the template:

    $this->hidden_fields['membership_id'] = $membership_id;

    You will need to have constructed the $membership_id value based on the user’s values. When the record is submitted, the membership id will be saved with it.

    Thread Starter jamshaid32

    (@jamshaid32)

    Hi Sir can you please help me
    please visit my that page
    https://www.bradfordfhs.org.uk/members-interests/add-interest/
    i want to add a username of login user as a default value in the First field “Membership ID”
    can you please help me how i can add this
    Thanks

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘want to add only 1 search filter’ is closed to new replies.