Sql action when registering + value in component

12 years 5 months ago #182344 by dotcom22
hello

I'm currently testing CBsubs for see if I will able to use for make some specific task and action with another component called Jreviews.

Jreviews is a nice component who allow to manage listings (like Sobi but it is more powerful). In my case I own a website where I have many listing and each of them are business listings. When I imported all listing data (like name, address, street, city, phone and more) I have also imported a unique secret value/code for each listing (this value is hidden and are not displayed in the listing).


Actually the owner of those listing is the super-admin user ID (that mean me) and if I want transmit the ownership of a specific listing to another specific user, I must actually change manually the user ID. My goal is to automatically do this task when a user who have the correct secret value (corresponding to his listing) introduce his secret code inside a CB registration field.

In fact I plan to contact by sending a standard postal paper letter each business for convince them to take the control of their own listing. That mean for example if I contact the restaurant "Happy Chicken" I will communicate in the letter the secret value corresponding to his "Happy Chicken" listing. So if the boss of this restaurant decide to take action and to register to the site, he must fill the related "secret" field with his code (something like: 4hk9hi2).

In practice is necessary to make a Sql action who will perform a check in the related Jreviews listing secret field for try to find the value "4hk9hi2". If this value is found, the ownership of the corresponding listing will change and will be assigned to this new user (but if possible only if the registration is confirmed due to the fact I enabled Email Confirmation in CB). If the value is not found a warning message must be displayed.

Do you think is possible to make something like this ??

thank

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

Please Log in to join the conversation.

12 years 5 months ago #182451 by beat
- FInding and assigning can probably be done with an SQL query using Auto Actions (that superseedes and includes SQL Actions now) plugin from the incubator www.joomlapolis.com/cb-solutions/incubator

- Checking key and Refusing registration without correct key is another story as the regular expressions validation for CB fields does not support ajax checks yet. But do you need that ? Maybe registrations should be accepted anyway, to make it simpler for people to get involved...

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

12 years 5 months ago #182554 by dotcom22
Ok great to know...Unfortunately I'm not a coder even if I have some very small knowledge of database manipulation with Sql query...

Can you help me to find the correct Action for find and assign the correct listing to new user based on the provided secret key? For your information, Jreview listing are based on standard Joomla articles..that mean a listing is in fact an article with same Itemid but all data related to listing are stored inside a specific and associative table.

- So the Jreview table is: jos_jreviews_content
- The Jreview secret key column is: jr_secret
- The Jreviews listing/article column ID is: contentid

What is the correct syntax for find and compare the key and assign the corresponding listing/article (if the key match of course) to the freshly registered user??

Now what I don't understand here is how to know the secret key provided by the user. I tried to create a new Auto-Action query but the action is not performed on a specific field but globally after a specific trigger (like After Registration or better After Confirmation). I imagine is necessary to insert the name of my secret CB text field (the one where the user must insert his key) inside the Sql action??

Another point is the fact I would like assign directly upon registration a specific Plan to the "business" users. This Plan will not be the same than the default Plan for standard users (but it will free of charge). Another specificity is the fact this Business Plan will place users inside "author" group and Standard plan inside "registered" group. So in practice in my registration form I want place a radio field with 2 option "Are you a user?" OR "Are you a Business Owner?". If the user tell to be a Business owner, I will conditionnaly display the Secret Key text field with a comment like "Introduce your Secret key belowe. If you don't have a Key click on this link" (if the user don't have a Key because this Business Owner discovered the site alone without having previously received my customized Mail Letter, I will explain another method for register).

- Checking key and Refusing registration without correct key is another story as the regular expressions validation for CB fields does not support ajax checks yet. But do you need that ? Maybe registrations should be accepted anyway, to make it simpler for people to get involved...


Yes you right but my goal here was not to impeach somebody to register but just to avoid to assign a listing to the wrong person. In practice the correct and wonderful process for me would be:

- If a user register telling is a normal user, I will not display (using conditional) the field "Secret Key". After confirmation this user will be placed inside the default Plan inside the group "registered".

- If a user register telling is a Business Owner and if his Secret Key is correct, after confirmation this user will be placed inside "Business" Plan inside the group "Author" and his listing will be assigned to him. Now if the Secret Key is wrong (due to mistype or because somebody tries to be clever and play with the form) , what to do in this case? The best would be to treat this user like a standard user and allow him to register normally. Now I don't know if is possible to give to him another attempt for insert his Key (in case of mistype)...


It seem this setup is complex to achieve...but maybe your CBSubs can do that...

thank

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

Please Log in to join the conversation.

12 years 5 months ago #182567 by nant

dotcom22 wrote:
In practice is necessary to make a Sql action who will perform a check in the related Jreviews listing secret field for try to find the value "4hk9hi2". If this value is found, the ownership of the corresponding listing will change and will be assigned to this new user (but if possible only if the registration is confirmed due to the fact I enabled Email Confirmation in CB). If the value is not found a warning message must be displayed.

Do you think is possible to make something like this ??

thank


Chiming in here to assist.

I have just published a new tutorial section called "use cases" that has its first tutorial which is similar in concept with with your use case.

Take a look at it here:
www.joomlapolis.com/support/tutorials/107-use-cases/18219-changing-approval-workflow-based-on-cb-field-value

You would need of course Professional membership to download CB Auto Actions (one of the incubator add-ons).

Regarding your request for further assistance, we have no experience with jReviews.
Someone would have to spend quality time to install, test, and analyze the database scheme and various tables and states to design the needed queries.

Perhaps you have someone in-house that can help you with this?

Please Log in to join the conversation.

12 years 5 months ago #182580 by dotcom22
Well I read the tutorial and is more less what I need...great coincidence... :-)

However in this case any user who tick the cb_singlebox will be placed in "awaiting approval" status and this is not exactly what I need... Maybe for make more simpler is better to always follow this process and to confirm manually if this specific user must or not be activated based on the provided Key value.

Now about the message it will more professional to display and send a specific message instead to mix all explanations (message for normal user and message for special user who ticked the checkbox). Do you think is possible to customize the message ???

Unfortunately I have nobody available for help with Sql queries and Jreviews.. However is just matter to find and compare a value present in the table (according to the table structure I mentioned previously) and take the appropriate measure. The Jreviews table is similar to any other component... If you have a suggestion for a querie it will wonderful like that I can test on my DEV site...

many thank

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

Please Log in to join the conversation.

12 years 5 months ago #182581 by nant

dotcom22 wrote: Well I read the tutorial and is more less what I need...great coincidence... :-)

However in this case any user who tick the cb_singlebox will be placed in "awaiting approval" status and this is not exactly what I need... Maybe for make more simpler is better to always follow this process and to confirm manually if this specific user must or not be activated based on the provided Key value.

Now about the message it will more professional to display and send a specific message instead to mix all explanations (message for normal user and message for special user who ticked the checkbox). Do you think is possible to customize the message ???


I assume you can stop the initial CB messages all together and use CB Auto Actions to send personalized messages to begin with - good addition (would need to test of course).


Unfortunately I have nobody available for help with Sql queries and Jreviews.. However is just matter to find and compare a value present in the table (according to the table structure I mentioned previously) and take the appropriate measure. The Jreviews table is similar to any other component... If you have a suggestion for a querie it will wonderful like that I can test on my DEV site...

many thank


You are correct on the analysis process needed. Unfortunately the entire process would take at least a couple of hours to install, test, analyze, implement and test again.

And to be frank, I cannot spare this time - too many projects in the pipeline.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.212 seconds

Facebook Twitter LinkedIn