Allow users to tag themselves

134 views
Skip to first unread message

Joe Palmer

unread,
May 17, 2013, 11:32:31 AM5/17/13
to joomla-de...@googlegroups.com
I have been playing with the great new AJAX tagging system in v3.1.2 and have been trying to allow users tag themselves during registration and profile edit. I have applied this fix to allow the profile details to be saved:

https://github.com/joomla/joomla-cms/pull/1082/files

I then added this into the profile.xml (I will eventually build my own plugin):

<field name="tags" type="tag" mode="ajax"
    label="JTAG" description="JTAG_DESC"
    class="inputbox span12 small" multiple="true"
/>

The tags field is shown and I can add or choose from tags as I type. However, when I save, only the tags that were already in the database get saved. Any new tags that were added get lost.

Also, the tags field is totally empty when viewing the profile.

Am I missing something or is this a bug? I haven't changed any of the default tag settings.

Thanks for any help. :)

elin

unread,
May 18, 2013, 11:39:31 AM5/18/13
to joomla-de...@googlegroups.com
I really want to have tagging of users possible both by users and by admins.  For example, I like in Stackoverflow that the profile shows the user's tags. You can see that users are already a type in the type table but the implementation is really a question mark in my mind.

The tagging of records uses the store()  method from JTable but as far as I know the profile table is not an instance of JTable.  So you would need to do a workaround to do the processing in a different way. It certainly can be done but it requires a bit of work. Alternatively tags could be added to the parameters of com_users but I'm nto sure how I feel about adding things there.

Elin

Joe Palmer

unread,
May 20, 2013, 8:48:37 AM5/20/13
to joomla-de...@googlegroups.com

Thanks you very much for this explanation, I now understand why tagging is not working properly in user's profiles.

I'm happy to do some development to get this working as it is a key feature of the site I'm developing. If I need to develop a workaround for this site then fair enough but I think the best solution would be to find the 'proper' way to it in Joomla. Then the solution could be added to Joomla for everyone to benefit from.

Let me know how you think I can help with this. If you can give me a spec, I'm happy to develop it. :)

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send an email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

elin

unread,
May 20, 2013, 9:53:01 PM5/20/13
to joomla-de...@googlegroups.com
Just off the top of my head .... there are a couple of approaches as I said. Unfortunately right now we don't really treat user profiles as content and hence you would need to think about that. To work with tags you would really want to save the user profiles in the ucm_content table (in addition to or instead of the profile table--for b/c purposes probably in addition).


As you can see I have already somewhat set this up in the types table

https://github.com/joomla/joomla-cms/blob/master/installation/sql/mysql/joomla.sql#L397

So if you updated JTableUser to do a ucm_save  you would be able to run through the tags processing api.  The only issue is that it doesn't really have the metadata field or similar (possibly params would be the option to use as soon as the patch making the field name configurable is merged)  Then you could also possibly store the profile data in json in the body field, but that's just a side issue), the main thing is to save the tags in metadata and the mapping table. Then you would be able to render the tags when you render the profile in the same ways you do everywhere else. Anyway that's the concept I would try. I'd love to see a pull request for a working implementation.

Tagging users is really powerful, because it gives you the possibility of opt in groups and also for things like putting moderation on a user.

Elin

To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.

Joe Palmer

unread,
Jun 11, 2013, 11:53:48 AM6/11/13
to joomla-de...@googlegroups.com
Thanks for this explanation Elin. I have spent today trying to get this working but havent had any joy. I focused on editing the JTableUser class in libraries/joomla/table/user.php and tried to do a ucm save but no luck so far.

Am I editing the correct file? Can you point me at a good example of a ucm save? I have also gone through this tutorial and modified the table class but is seems like much of the rest code already exists for users:

http://docs.joomla.org/Using_Tags_in_an_Extension

I'm happy to spend more time on this but I still feel a bit in the dark as to exactly what I'm trying to do.

Thanks for any guidance you can give. :)

Phil

unread,
Jun 20, 2013, 9:44:12 AM6/20/13
to joomla-de...@googlegroups.com
Hi Joe and Elin,
This is exactly what I need, is there any progress on the subject. I need to put tags against users and found that it just does not work.
I have looked through Elins suggestions but I to do not have the detailed knowledge to get this missing use of tags fixed. Is there someone on the development team who worked on the tags who could help Joe finished it off as he seems to have put in a fair bit of work already and it would be cool to have this feature working in the next release. It does seem a whole in the use of tags.

Kind regards

Phil

elin

unread,
Jun 20, 2013, 6:57:18 PM6/20/13
to joomla-de...@googlegroups.com
We're actually going to have a couple of api changes in the next maintenance release that will make it a little easier.   The UCM save should be totally set up for you given that we already have a content type.

I'll take a look at this with the new apis in place and post  if I have news. Joe do you have your code in a repo somewhere? I'm assuming you're talking front end right self tagging and display?

Elin

Joe Palmer

unread,
Jun 21, 2013, 11:24:58 AM6/21/13
to joomla-de...@googlegroups.com
Thanks Elin, it's good to know there will soon be changes to make this easier. :)

I don't have my changes in a repo but I've attached libraries/joomla/table/user.php which has all the changes I've made that seem to make sense (but don't seem to work).

You are correct, I am talking about front end self tagging and display. You can see the progress I have made here and you are welcome to register/test as this site is still under development.

Thanks you all your help.


--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

To post to this group, send an email to joomla-de...@googlegroups.com.
user.php

elin

unread,
Jun 21, 2013, 5:16:42 PM6/21/13
to joomla-de...@googlegroups.com
This is really really messy (and front end only)  and not finished or what I would want it to be like for real but it does save.  Users is a little (to put it mildly) different than the rest, especially in the front . But it's saving the data to the session anyway so ... 


Maybe you can use it and also we can think about what it actually should look like. 

Elin


On Friday, June 21, 2013 11:24:58 AM UTC-4, Joe Palmer wrote:
Thanks Elin, it's good to know there will soon be changes to make this easier. :)

I don't have my changes in a repo but I've attached libraries/joomla/table/user.php which has all the changes I've made that seem to make sense (but don't seem to work).

You are correct, I am talking about front end self tagging and display. You can see the progress I have made here and you are welcome to register/test as this site is still under development.

Thanks you all your help.
On 20 June 2013 23:57, elin <elin....@gmail.com> wrote:
We're actually going to have a couple of api changes in the next maintenance release that will make it a little easier.   The UCM save should be totally set up for you given that we already have a content type.

I'll take a look at this with the new apis in place and post  if I have news. Joe do you have your code in a repo somewhere? I'm assuming you're talking front end right self tagging and display?

Elin


On Thursday, June 20, 2013 9:44:12 AM UTC-4, Phil wrote:
Hi Joe and Elin,
This is exactly what I need, is there any progress on the subject. I need to put tags against users and found that it just does not work.
I have looked through Elins suggestions but I to do not have the detailed knowledge to get this missing use of tags fixed. Is there someone on the development team who worked on the tags who could help Joe finished it off as he seems to have put in a fair bit of work already and it would be cool to have this feature working in the next release. It does seem a whole in the use of tags.

Kind regards

Phil

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.

Joe Palmer

unread,
Jun 24, 2013, 11:38:47 AM6/24/13
to joomla-de...@googlegroups.com
Thanks very much Elin, this is brilliant! I have deployed your tagusers branch onto our development site and new tags do now save! :)

The first time I tried to save, I got this error message but it only happened once:

Profile could not be saved: Duplicate entry '5-603-6' for key 1 SQL=INSERT INTO jvedg_contentitem_tag_map (`type_alias`,`core_content_id`,`content_item_id`,`tag_id`,`tag_date`,`type_id`) VALUES ('com_users.user', 3, 603, '6', CURRENT_TIMESTAMP(), 5),('com_users.user', 3, 603, '6', CURRENT_TIMESTAMP(), 5),('com_users.user', 3, 603, '13', CURRENT_TIMESTAMP(), 5),('com_users.user', 3, 603, '14', CURRENT_TIMESTAMP(), 5),('com_users.user', 3, 603, '15', CURRENT_TIMESTAMP(), 5),('com_users.user', 3, 603, '16', CURRENT_TIMESTAMP(), 5)

It is interesting to see you have the tags in the "Edit Your Profile" area rather then the "User Profile" area, I was trying to add the tags to the User Profile plugin so they could be configured from the backend. I see that the tag retrieval isn't working in your version but interestingly the tag retrieval works fine when the tags are in the User Profile, just new tags don't get saved (existing tags save fine).

Will your approach also work for registration? For the site we are working on, it is a key requirement that user's can tag themselves during registration. Existing tags do save during registration with the User Profile plugin approach so I'm wondering if it is possible for the functionality you added to work with the User Profile plugin. It would then be possible to configure when to display the tags field. I've attached the modified User Profile plugin I created which you can install alongside the core one.

Thanks for making progress on this!

Joe
profilephd.zip

Phil

unread,
Jun 28, 2013, 6:29:51 AM6/28/13
to joomla-de...@googlegroups.com
Front end is great for what I am doing. Just the whole round trip of save and retrieve would be great. It seems with both of yours added together it seems to be a full solution. I have added the profile phd plugin and can confirm that the tags are retrieved but new dont save. If the full cycle can be achieved I will be happy to test and report back any findings..Great work both of you, many thanks.

elin

unread,
Jul 4, 2013, 11:03:09 AM7/4/13
to joomla-de...@googlegroups.com
Doing it in the  profile area would also be a possibility although the handling would have to be different.  You don't actually save tags with the data, just in the mapping table so you could definitely add tags to a profile but you would need some special handling in the plugin to make sure that storing works. If we did user tagging in the core I think it's an interesting question to think about whether it makes more sense to do it in the core user handling or in a profile plugin. 
 
We're making some small modifications to the tags api (not requiring a metadata field is already merged) that will make it easier to use tags.  I do think that with ucm we'll want to treat the profiles as content not the users and using the profile plugin will be helpful for that.  That said, there are some real questions about the overlap between contact and profile plugin and it would probably be better to make the contact creator optionally map specific fields if people want to use them for searching and sorting.  We already have a good way to store tags in contacts so that may be something to think about.

Elin

Ove

unread,
Jul 4, 2013, 8:22:01 PM7/4/13
to joomla-de...@googlegroups.com, elin
As I wrote somewhere else IMO the user do not belong to content. A member i.e a user with more data than an email address may do. Name and Username is not very personal in Joomla. It's about privacy and differencies in legislation. In some countries you need an official approval to store user data and allways be ready to give the user information about any stored data via postal mail.

Exampel: a not regular user of Facebook got his information after a court decission. A box including 1000 full written pages.



elin skrev Donnerstag 04.07.2013 17:03:

Joe Palmer

unread,
Jul 5, 2013, 6:00:25 AM7/5/13
to joomla-de...@googlegroups.com
I see the dilemma, thank you for explaining it. I agree that the users should not be the content but the profile data could be. It sounds like your approach is the best way at the moment, attach the tags to the users as this following the normal format. The only special options that may be required is the ability to choose whether the user and/or the admins can do the tagging at registration/frontent/backend.

I'm happy to help do more testing... :)


--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages