Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
- This topic has 14 replies, 2 voices, and was last updated 5 years ago by
Joshua Tempesta.
-
AuthorPosts
-
08/10/2018 at 4:35 pm #469739
Joshua Tempesta
ParticipantCan I please have the instructions to how to manually link someone in the database? Since there is no way to manually do it from the admin backend.
I am currently inserting a usermeta entry for connections_entry_id that corresponds to the connections primary key and user primary key.. However that user cannot edit their entry.
Can you please tell me what roles are required for users to edit their entries? I currently have my user role set to “Edit Entry” and “Add Entry”.
Any help would be much appreciated! Thank you
08/12/2018 at 12:51 pm #469860Steven Zahm
Keymaster@ Joshua
Add a new user meta key
connections_entry_id
to the user where the value is the Connections Entry ID.Also, update the entry row in the
{wpdb-prefix}_connections
. Set theuser
field with the WP User ID.Hope this helps!
09/25/2018 at 1:18 pm #473239Joshua Tempesta
ParticipantHi again,
Sorry it’s been a while since I tried this but unfortunately this doesn’t seem to help.
After doing what you said I now see in the connections manage admin area that it is linked to the correct user. However on the site it still does not allow my user to modify their own record.
I have both the edit and add entry permissions selected for that user’s role.
However they do not see “Edit my directory entry” in the list. They just see “Add my directory entry” like they are doing a brand new one.Please advise. :) Thanks again!
What do you think I should try next?
09/25/2018 at 2:02 pm #473249Steven Zahm
Keymaster@ Joshua
On the
init
hook in WP Link will fetch the current logged in users meta value forconnections_entry_id
. If found and there is a value is not empty or greater than 0 the entry with that ID is fetched from the DB and saved as a new Entry object unless when fetching that entry by ID does not return results.When the add/edit link is display, it checks if the Entry object exists and display edit if it does or add if it does not.
So, this background, I hope helps you track down the issue.
As a thought, to manually link a WP User and an Connections Entry… Link supports the User Switching plugin or did the last time I tested. So, make sure the WP User email address and the Connections Entry have identically matching email addresses and then “switch” to that user. This will trigger the linking which just updates the two fields in the DB as noted in a previous reply before setting up the variables as mentioned above in this reply.
Hope this helps, let me know.
09/25/2018 at 2:07 pm #473251Joshua Tempesta
ParticipantThanks again for your extremely quick reply. So I have manually debugged with my limited set of skills to this point:
private static function setCurrentEntry() { // Grab an instance of the Connections object. $instance = Connections_Directory(); $result = $instance->retrieve->entry( self::$entryID ); if ( FALSE !== $result ) { die("currentEntry assigned"); self::$currentEntry = new cnOutput( $result ); } else { die("currentEntry not assigned"); } }
self::$entryID is not null and is a real connections entry however it seems the result is returning FALSE
What are my steps for debugging further than this? I need to figure out why the retrieve entry method is returning nothing yet the record ID is clearly there..
Please advise.
09/25/2018 at 2:23 pm #473253Steven Zahm
Keymaster@ Joshua
Can you
var_dump(self::$entryID);
and post the result?09/25/2018 at 2:29 pm #473254Steven Zahm
Keymaster@ Joshua
If
var_dump( $result )
is bool false the that mean the WP DB query did not return any results for the supplied ID.Just thought that info might help.
09/25/2018 at 3:16 pm #473262Joshua Tempesta
ParticipantSteven:
var_dump($result) returns bool(false)
var_dump($entryID) returns varstring(5) “662 ”
I’m in my database and ID 662 definitely exists.
I copied the site i was working in and reinstalled all connections related plugins to ensure there was nothing else modified. I am only running the base plugin, link, and your default template.
Please advise.
09/25/2018 at 3:20 pm #473263Joshua Tempesta
ParticipantSteven:
I just noticed there was a space at the end of the variable and the method was treating it like a string instead of an integer id:
“662 ”
After adding this code everything started working:
$result = $instance->retrieve->entry( (int)trim(self::$entryID) );
this might be overkill and im a noob at PHP but this fixed it for me.. Can you please confirm my fix to be true?
09/25/2018 at 3:45 pm #473265Steven Zahm
Keymaster@ Joshua
Right there is the issue… however you added the value to the DB it ended up as a 5 character string. It should have been an integer. Even a string would would work if it was
varstring(3) "662"
. Notice that instead of5
it says3
. The number is the number of character in the string.Adding the trim, although will “fix” the real source of the error is the value in the DB. I would recommend simple correcting the source value rather than trying to clean it up after the fact.
In any event, great to see you rooted out the issue.
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.