1

I have a site in development using Zoo Visitor 1.3.34 (latest version) and EE 2.9.2. Currently, I'm running into a small stupid problem that might be a Zoo Visitor bug. I know I could write a tiny extension to fix the issue, but am wondering if anyone else has run into this issue.

When a new user is registered, they get their EE Member rows created, and Zoo Visitor creates an entry in the Zoo Visitor channel. Zoo visitor has a hidden field that holds the Member ID (so it can associate it's channel entry with the logged in user). When a new user is registered via a front-end

{exp:zoo_visitor:registration_form}

tag, everything goes fine, but the field that holds the Member ID in the Zoo Visitor channel does not get populated. If I then open that Members Zoo Channel entry and give a submit, it then populates that field. This is an issue because I'm using a Zoo Channel field to control permissions, and need to look up the members channel entry without someone having to open each new users Zoo channel entry and submitting it.

Any ideas I'm missing besides just making an extension that hooks to

zoo_visitor_register_end

and updating the Member ID field manually after registration? Zoo Visitor has way too much code for me to spend the time to track this down if it is a bug. Thanks!

  • LOl, only just realised who asked the question! ERK! Flagging as too broad, duplicate, not relivent ect now... hahaha :P – Blatant Jun 2 '15 at 16:36
1

On the template where your member is taken after registration, try adding this tag : {exp:zoo_visitor:sync}

This will force the fields to sycronize between members fields and channel entries, which I beleive is whats happening when you go into the CP and 'submit' the member entry anyway. The tag is undocumented ASAIK, but it's referenced in these places:

It's more for members created by other means (like Social Pro) but I beleive it might help out, and hey, it takes 5 mins to check this solution!! Let us know if it works/how you get on.

Just a guess from a related question but it might kick things into life!!

| improve this answer | |
  • Hey Blatant, I want to share an addon idea with you (privately). If you see this, I can share a melt mail email address and we can discuss. Comment back and we will talk! – jrothafer Jun 3 '15 at 7:22
  • I was about to delete this as a wrong answer but I saw your comment. sure drop me a line, not sure how best to connect here :S – Blatant Jun 3 '15 at 9:52
  • Hit me up at GJEsBK8197zU@meltmail.com, I'll share my real email with you. It might be a dumb/already done idea, but I'd like to throw a thought at you! – jrothafer Jun 3 '15 at 16:49
1

I hate to be one of those people, but I couldn't move on until I fixed this issue. Here's how I did it. In my plugin to check for permissions, I was looking up the Zoo Visitor Channel entry by looking at that field to match member_id:

// get zoo row
$member_id  = ee()->session->userdata('member_id');

$zoo_dept   = ee()->db  ->select($this->zoo_department_field)
                        ->from('exp_channel_data')
                        ->where($this->zoo_member_id_field, $member_id)
                        ->get()
                        ->row_array();

Instead, I found a helper function in a Zoo Visitor helper called get_visitor_id. So in my plugin __construct, I added this:

ee()->load->add_package_path(PATH_THIRD . 'zoo_visitor/');
ee()->load->library('zoo_visitor_lib');

and then I use that helper function to look up the row:

// get zoo row
$visitor_id = ee()->zoo_visitor_lib->get_visitor_id($member_id);

$zoo_dept   = ee()->db  ->select($this->zoo_department_field)
                        ->from('exp_channel_data')
                        ->where('entry_id', $visitor_id)
                        ->get()
                        ->row_array();

and continue along with my normal permissions checks! It would be nice if Zoo Visitor documented their API and helpers for developers, but it's OK, I enjoy investigating code.

  • overkill, OVERKILL!!! lol, I KID! whats going on jchrono? It's like role reversal, Normally I rattle on with long old PHP solutions and someone (like you) comes in with the 2 line solution! but in this thread, well... – Blatant Jun 2 '15 at 16:34
  • LOL, thanks for the suggestion brotha. That template tag almost certainly been the fix, but we don't allow them to log in until after they are approved (at least right now), and then we'd have to call {exp:zoo_visitor:sync} on every log in, which seems like a waste of SQL calls! or not! who cares! :) – jrothafer Jun 2 '15 at 16:43
  • I'm not saying after login, but more on the page they get taken to after registration (aka the "thanks for your interest" page), but that does raise another good point, does the sync tag sync all members or just the logged in member (if there is one)? I'd be curious if the tag actually fixes the problem though (regardless of implimentation issues)... – Blatant Jun 2 '15 at 16:45
  • Hey! It actually doesn't. I just ran a test (just for you, buddy!). After registering a user and approving them, I logged them in and directed them to a test page with that tag, and it doesn't populate that channel_data field! Only and entry form submit seems to do it. – jrothafer Jun 2 '15 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.