Support » Plugin: Participants Database » Using Participants Database with WordPress Users

  • Roland

    Excellent plugin! I have read your article on linking PDB with WP users and have followed your directions for creating the user_login field:

    1. created field user_login
    2. set form element type to “hidden field”
    3. used “current_user->user_login” in the default setting

    I then created a new user via the signup form with my logged in admin account. I received the signup thanks message on same page with the correct username shown as I had adjusted the message to include [user_login].

    However, when I search on the admin or using the list shortcode the record doesn’t exist, even though I received an email notification of the new signup. That email had the link for editing the record, and shows the new record number at the end “id=1402”.

    When I click that link I arrive at the PDB dashboard and not the actual record, although I’m experiencing this will all test accounts I’ve tried so far.

    Also, when I include ‘user_login’ in the list display I see the default “current_user->user_login” for all records (and my test account is excluded).

    Wondering if I missed something here?

    Thanks

    https://wordpress.org/plugins/participants-database/

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

    (@xnau)

    You don’t say what you are searching for and not finding the record, so I can’t speak to why the record (which I am certain exists) doesn’t show up in the results. I assume you see all the records if you visit the admin List Participants page without any search, correct?

    If the admin edit link doesn’t take you to the record (I’m assuming it’s taking you to the “list participants” page) it could be due to another plugin. I’ve never seen this problem, and I’m not sure how it could come about. I would suggest you verify the link as it appears in the admin notification email by comparing it to the edit link (the one with the pencil) as shown in the admin list participants page.

    Finally, the hidden fields, when displayed on frontend lists will show the default value if there is no saved value. This behavior has been changed in the next version: it will show the saved value if it exists, and nothing if it doesn’t. I’m sorry the current implementation of the hidden dynamic field does not work as it should when displayed on frontend lists.

    I have verified that in 1.5.4.9 it will show the saved value, however, so if you don’t see your saved value, you may need to look at the database entry directly to see what it contains.

    This is possible?

    <tbody>
    		<?php while ( $this->have_records() ) : $this->the_record(); // each record is one row ?>
    				<?php $record = new PDb_Template($this); ?>
    				<tr>
    				<?php while( $this->have_fields() ) : $this->the_field(); // each field is one cell ?>
    				  <td class="<?php echo $this->field->name ?>-field">
    					<?php
    					/*
    					 * put the edit link URL into the link property of the field
    					 */
    					if ($this->field->value('user_login') == ' . $current_user->user_login . ') {
    							if ($this->field->name == 'edit_link') {
    							  $this->field->link = $record->get_edit_link();
    							}
    							$this->field->print_value();
    					}
    					?>
    				  </td>
    			  <?php endwhile; // each field ?>
    			  </tr>
    			<?php endwhile; // each record ?>
    		</tbody>

    Performing tests of these changes does not work because I do not know how to retrieve the value of the database belonging to user_login to make the comparison.

    Error Message. Fatal error: Call to undefined method PDb_Field_Item :: value () in……

    Plugin Author xnau webdesign

    (@xnau)

    You need to use the $record object to get the value:

    $record->value('user_login')

    xnau

    My bad…I hadn’t added it to the signup form via the manage database fields area.

    Will continue to work with this feature.

    Thanks

    It would be good if I use it this way?

    <?php if($current_user->user_login == $record->value('user_login')){?>

    Plugin Author xnau webdesign

    (@xnau)

    Yes, that should work.

    To summarize what I want to accomplish.
    Create a template with the name pdb-desktop-list in which only registered users matching the record to edit the data they have stored.

    I have the solution you already public and explain but it does not work. Join the short code but does not return me any results, seeing the source code I manage to spot that the function is printed.

    What I’m looking for another solution is to make the template.
    Before you print the table I placed the code.

    <?php if($current_user->user_login == $record->value('user_login')){?>
    
      <table class=.....

    And in the end

    ......</table>
    	<?php } else {   ?>
    	<!-- here is a paragraph that is shown to anyone not logged in -->
    								<p>Is necessary<a href="<?php home_url(); ?>/wp-register.php">registering</a>, to see your records.</p>
    							<?php } ?>

    Error screen.
    Fatal error: Call to a member function value() on a non-object in…

    I appreciate your kind help if someone needs it or want to review I leave for future discussions.

    Thanks for the help Xnau

    Link to the file

    Plugin Author xnau webdesign

    (@xnau)

    cristch_27…this would have been better done on a new topic….

    I made a mistake…the correct method is get_value:

    $record->get_value('user_login');

    Thank you very much, but to help the community and publish a post will send it to manual.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Using Participants Database with WordPress Users’ is closed to new replies.