Forums

CB plugin, hidden fields in CB

Els 18 Nov, 2008
Hi,

in the configuration for the CB plugin, there's a list with all the fields that are displayed in CB's own registration form.
But the thing is, that I've got 4 hidden fields in the CB registration form, which aren't part of the list of custom fields in CB, which I would like to pass from a Chronoform just like the regular fields. They are hidden fields I added to the form manually, and which add the new user to the Acajoom newsletter component.

Would there be any way I could pass these fields from the Chronoform to the CB registration?
Max_admin 18 Nov, 2008
if I understand it correctly then add them to the CB ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 18 Nov, 2008
Yes. CB has an Acajoom plugin, and that's where those hidden fields' values should end up.
Max_admin 18 Nov, 2008
ok good, why not adding those fields to the CB ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 18 Nov, 2008
They are already there.

What I currently have, is a regular CB registration form, with the necessary fields for the Acajoom plugin as hidden fields.
What I want, is to use Chronoforms instead of the CB registration form. And not lose those hidden fields.
To make that happen, I would need to add those fields to the list in the configuration of Chronoform's CB plugin. But I don't know how, as they are not listed there.
Max_admin 19 Nov, 2008
Hi Els,

so you mean that Chronoforms CB plugin config lists all the CB custom fields except the hidden fields ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 19 Nov, 2008
That's exactly it, yes.

I think the problem stems from the fact that the Chronoform CB plugin only lists actual CB fields, and CB itself doesn't have an option to add hidden fields in their custom fields list. So I added those hidden fields myself, directly into the form. They're not in the CB custom fields, even though they're picked up by CB's Acajoom plugin.

I've already tried the alternative: adding the user directly from Chronoform to Acajoom. This ends up with the synchronisation between CB and Acajoom being lost though, so unfortunately not an option.
Max_admin 19 Nov, 2008
hmmm, try to add some custom fields to CB with the same names as your hidden ones but unpublish them in CB, this way you get the CF plugin to list them and at the same time you don't have them in CB, I'm not sure if this will do it exactly as we need!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 19 Nov, 2008
I already have two unpublished custom fields in CB, and they don't show up in Chronoform's CB plugin.

I thought of one other option, but I think it's only wishful thinking: adding the fields to the CB plugin manually. Adding them is not a problem, but I doubt they would actually work. I don't know enough of PHP to figure out what part of the code picks up what I fill in in the plugin and takes it to CB.
Max_admin 19 Nov, 2008
Hi, find this line in the plugin code:
$database->setQuery( "SELECT * FROM #__comprofiler_fields WHERE published='1' AND `table`='#__comprofiler' AND name <>'NA'" );


remove the published = '1'
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 19 Nov, 2008
Thanks, that works to get non-published fields into the plugin configuration. Of course, custom cb fields always get the cb_ prefix, so it won't work 'out of the box', but I'll try and see if I can work around that. I'll let you know the results as soon as I have any - thanks again :-)
Els 19 Nov, 2008
I think the connection between CB and Acajoom is more complicated than it looks at first sight. The information for Acajoom from CB's registration form, goes into the Acajoom tables, not into CB tables.
And even if the trick with the unpublished fields would work, (which I don't think it will, since the information from CF's plugin goes into CB tables, not into Acajoom tables), I'd have to rename the database fields in Acajoom itself to get the cb_ prefix in them.

I've also tried my other idea, adding the fields manually to the plugin. That in itself worked, but of course the information was not added to Acajoom, as I thought.

I'm afraid I'll just have to give up on this idea, even though I'm still not 100% convinced it can't be done. For now I'll let this idea pass, but if I ever continue and find a solution, I'll let you know.
Max_admin 19 Nov, 2008
Hi Els,

if its just as you say then this is too easy to do, what are the fields and tables which should get modified in acajoom to get the new user subscribed to some list? you can just do this with a pure free chronoform!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 19 Nov, 2008
Hi Max,

To be honest, I hadn't even thought of looking if a paid version would have more options ... just didn't cross my mind.

Even if you could update those tables straight from within Chronoforms, I'm not sure the effect would be the same.
The thing is synchronisation; the Acajoom table has two id columns, one with the Acajoom subscriber id, and one with the CB/Joomla subscriber id. So it's not simply inserting new values into the Acajoom subscriber table, but also adding the new Joomla user id into that table. You still think that is doable?

There is one more thing I'm wondering about, that I can't seem to figure out if it's because of my setup, or if that's just how the CF CB plugin works:
when I add a new user through Chronoforms, I receive Joomla's own confirmation link email, instead of CB's. Also, the new user is added as "blocked, confirmed, approved", while if I register directly via CB's registration form, I receive CB's confirmation link email, and I'm added as "blocked, unconfirmed, approved". Both will change to "enabled, confirmed, approved" once that confirmation link is clicked, but the whole route is different. Different confirmations on screen, different emails...

When I installed CB, I was supposed to set Joomla user registration to off, in order to force people to subscribe via CB.
For Chronoforms to be used instead, I have to set Joomla user registration to on, or it won't work. Would that be the cause of what I described above?
What would happen if in the CF CB plugin, I'd take away this line?
		if ( $mosConfig_allowUserRegistration == 0 ) {
			mosNotAuth();
			return;
		}

Would that enable me to leave the global setting for user registration to off, and force the registration through CB, even though in fact via Chronoforms? (I don't think so, but just asking to be sure :-))
Max_admin 19 Nov, 2008
Hi Els,

the whole bottom question and thoughts are correct, you can do that change and all your ideas are correct, in the CB plugin we use everything as if its a Joomla registration process but only add the user to CB table, that's all!

now back to our main path, this is doable, you need the registered user id, I see you have started to look into the plugin code so this should be easier for you now, you can get the new user id after its added by adding this code :

global $cf_cbjust_registered; echo $cf_cbjust_registered->id;


of course you don't need to echo it, but if you added the code above to the onsubmit after email box for example then you will see the registered user id, use it in your code instead! and I guess the acajoom user id is generated auto.

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 20 Nov, 2008
Hi Max, that looks quite promising. Unfortunately I don't have much time to play with it until Tuesday, but I'll sure be back then with more exact questions about the implementation. Thanks for all the help so far already though, I really appreciate it :-)
Max_admin 20 Nov, 2008
No problems!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 28 Nov, 2008
Hi Max,

Tuesday was delayed by 3 days, but here I am again :-)

You said I can use this code:
global $cf_cbjust_registered; echo $cf_cbjust_registered->id;

but I'm not sure where to use it.
I realise I'll need the resulting ID to be added to Acajoom tables, but I've not really any idea on how to do that.

The tables in Acajoom that need the information, are:
jos_acajoom_subscribers, with these columns:
id (automatic)
user_id (which would be $cf_cbjust_registered)
name
email

and jos_acajoom_queue, with these columns:
qid (automatic)
subscriber_id (same as the automatic id in the jos_acajoom_subscriber table)

For both tables there are more fields, but they always get the same input, so I can add them into the code myself once I know how it works.

I'm thinking that even if you could add the fields to the subscribers table, it would be problematic (if not impossible) to also add the automatic 'id' from that table to the subscriber_id column in the queue table? That said, I don't even know if these fields are at all automatic, or if there is a 'fetch value, +1, insert' script for it.

There's another thing that I'm not sure would spoil the whole idea though:
When a user clicks the confirmation link he receives when registering through CB, this automatically makes the Acajoom subscription confirmed too. Now that the confirmation is done through Joomla instead of CB, I'm not 100% sure this would be propagated to Acajoom too. (I don't know how it works in the CB setup).
I guess it's a matter of testing and seeing what happens...
(would crossing my fingers help?)
Max_admin 28 Nov, 2008

I guess it's a matter of testing and seeing what happens...


Yes, this is the key at these issues, you know what, I would do the same but may be I will be quicker because I work with Joomla all time, but we will take the same way!😉

so where do you use that code, this code will give you some value after the user is inserted in the CB table, look at the plugins order tab, see when the plugins are executed, after it you can use this line of code to retrieve the CB user id!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 01 Dec, 2008
Hi Max,

I've set the order of the plugins to first execute the CB plugin and then the OnSubmit stuff, added the code there, but I really don't see how this is gonna help me getting code into Acajoom's tables? In fact, even the 'echo' statement doesn't have any effect, because on submitting the form, I get redirected to Joomla's confirmation message. That doesn't matter though - I don't have to see the user-id - I just need it to go into the Joomla tables. But as I explained in my previous message, I'm not sure it can actually be done, due to the 'interconnectedness' of user id, automatic id in one table, and subscriber id in another table.

Are you still saying this should be easy to accomplish? If not, not a problem at all, but if yes.. how? :-)
Max_admin 01 Dec, 2008
Hi Els, after changing the order and saving add this to the onsubmit after email box and remove any redirect URL, what do you get ?

    global $cf_cbjust_registered; echo $cf_cbjust_registered->id;
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 03 Dec, 2008
Well, there is no redirect URL, but I still get the ordinary confirmation on the page, nothing else:

"Registration Complete!

Your account has been created and activation link has been sent to the e-mail address you entered. Note that you must activate the account by clicking on the activation link when you get the e-mail before you can login."

That's all I get.
Els 03 Dec, 2008
follow-up: decided to echo an arbitrary sentence with that, and that one does appear on the page, right after the Joomla confirmation.
So.. code does get executed, just doesn't echo that $cf_cbjust_registered->id;
Max_admin 04 Dec, 2008
Hi Els,

are you sure that the order of the onsubmit submission is AFTER the plugin processing in the order tab ? is this code in the onsubmit AFTER email box ?

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 04 Dec, 2008
Hi Max,

Yes, I'm sure. I attached some screenshots - maybe they give away a clue I don't see?
[attachment=1]runorder.gif[/attachment]
[attachment=0]onsubmitafter.gif[/attachment]

The first line of that piece of code does work - it is added to the end of Joomla's 'success - you've registered' message on screen.

My first guess about the reason it doesn't work, is that there is no such thing as $cf_cbjust_registered in Community Builder. Or at least, I can't find any mention of it. Did I misunderstand some of your instruction earlier in this thread maybe?
Max_admin 04 Dec, 2008
Hi Els,

the code is in the CB plugin, so once its processed then this variable should be there!

do you have a table connected to this form ? try to create a table and connect to it and see if it saves the cf_user_id ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 04 Dec, 2008
Yes, I have a table that stores all the submitted content, but I have no idea how to make 'cf_user_id' show up in it.
It gives me the values of all form fields I enter in the first field under the 'DataView fields' tab. I even added cf_user_id to that, just as if it was a field name, but that didn't make a difference.

Also, I've done a global search on all files within Chronoforms component, but "just_registered" isn't in any of them. Neither is 'cf_user_id'.
'user_id' occurs only once, in the cb plugin file, on a line where it says
$fields2 = array('id', 'user_id');


Are we talking about the same Chronoforms version? I seem to be using 2.3.9.

Or "the code is in the CB plugin" implies that I had to put it in there? (which I didn't) ...
Max_admin 04 Dec, 2008
Hi Els,

did you tell me before that you have 2.3.9 ? if so then I'm really sorry, if not then you had to tell !!!🙂

my code will not work except on V3.0 stable for J1.5

I have no idea how to do the same in V2.3.9, it can be done the same way, may be if you opened the V3.0 stable cp plugin file and found how its done, may be you can do the same on V2.3.9!

regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Els 04 Dec, 2008
In this thread I never mentioned the version, I only mentioned I was using Joomla 1.0 in the thread I finished before starting this one.
http://www.chronoengine.com/forums.html?cont=posts&f=9&t=11657
You were in that thread too, but I think you may have missed that message. I was wondering why you added that last comment about compatability with J1.5 code space to that thread :-)

Anyway - if I ever need the same thing on an 1.5 install, I'll be back ;-)

I have no idea how to do the same in V2.3.9, it can be done the same way, may be if you opened the V3.0 stable cp plugin file and found how its done, may be you can do the same on V2.3.9!



I reckon that was still based on the assumption I'm running J1.5, right? ;-)
Max_admin 04 Dec, 2008
Hi Els,

no problems, well, its hard to tie between posts in your head unless I do them the same time....

you can copy the same function from the V3.0 plugin, you just define a global variable in the plugin file, I think this can be done easily!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.