jojo_community plugin and privacy features

Jojo_community plugin and privacy features, a forum discussion on Jojo CMS. Join us for more discussions on Jojo_community plugin and privacy features on our General Discussion forum.

Back to Forum Index : Back to General Discussion   RSS
Harvey

Core Developer

Harvey

28 Mar 2009
Posts: 327

Hi All,

Here's an email I posted to the development list yesterday, but I thought it would be worth posting here as well. This is all in the latest SVN copy, but definitely shouldn't be considered stable at this stage.

Have attached some pics to help explain. Note the 'public user profile' screenshot is not the default one, it's been modded as per the client's request to have the wobbly user images at the bottom.

Harvey.
harvey said...
I thought I'd let you know what I'm up to with the new jojo_community plugin, so your sites don't break and you can help me with testing etc.

There are 2 basic problems I'm trying to solve. Firstly, it's never been clean to add your own custom fields to the user table and get those same fields onto the register page. It meant adding the fields to the database (fine), customising register.tpl (ok) then hacking register.php to handle the error checking (downright nasty). The other problem was that I needed to keep certain fields private on a per-user basis for my current project - ie 'Peter doesn't want anyone to know his address, Paul is fine with country state details being displayed but not street address'.

With that in mind, I have modded Jojo so that the registration page and the user profile pages are generated based on the fielddata system. If you want a new custom field, add it to the database, run setup, configure the fielddata, and Jojo should take care of the rest.

Fielddata now has something called 'flags'. You will need these to let Jojo know if you want these fields on the register / profile page or not. You will see these in the autoupdate_user.inc.php file...

$default_fd[$table][$field]['fd_flags'] = 'REGISTER,PROFILE,PRIVACY,PRIVATE';

REGISTER = this field will show up on the register page.
PROFILE = This field is editable on the 'edit user profile' page, and is visible on the public user profile.
PRIVACY = The user is allowed to make this field private if they want to.
PRIVATE = This field is kept private by default (eg email address), it won't show on the public user profile.

When you add your custom fields to the user table, add the flags you need into the fielddata. For example, my job today needed a field for 'spouse name' and 4 extra image fields. I want all of these to appear on the profile (that's the whole point) but I don't want them on the registration form - I still want the registration process to be quick and simple. So, I set the PROFILE flag but not the REGISTER flag. I don't want the user to be able to choose whether this info is private or not - you wouldn't upload a pic onto Facebook unless it was to show other people right? However, things like physical addresses might be used internally, so good to give the user the choice on these.

I have moved the register and profile pages into a new plugin called jojo_community. This should be considered a required plugin for any site with user accounts - eg forums, affiliate, etc. I'd like to enforce this programatically sometime soon - we really need a required plugins functionality built into Jojo so give some thought to this.

For now, I don't want existing sites that need user registrations breaking, so I have left the existing plugins well alone in jojo_core. This is a bit of a funny situation, because the new plugins have the same URIs. So when you install jojo_community, it repurposes the existing pages to the new plugin, and the API should send the requests to the new plugin but I need to test this further. Existing sites shouldn't break if you don't install jojo_community, but I wouldn't recommend putting this to the acid test. Eventually we can delete the old plugins from Jojo_core.

I have basically all the functionality I need in there now, so are now testing and tweaking. It's a fairly complex bit of code, but I think the generated register page is a welcome improvement - certainly much easier to customise the page now. If this all goes well, I'm looking to make a new contact plugin which also uses fielddata.

Let me know if you find bugs, or better yet fix em :)

Harvey.
Rick Rick

2 Apr 2009
Posts: 336

It's great to see the user profiles being populated a bit more. With the community centric development you might want to check out bug #139 (insufficient permissions to log out).

I'm not trying to nitpick but I'm confused why the extra fields (address, suburb, city, privacy etc) were added to the core rather than a separate table for the new community plugin or simply added to the table by the plugin.

I'm either missing something or am far too critical for my own good. I'll admit it's usually the latter.
Harvey

Core Developer

Harvey

2 Apr 2009
Posts: 327

Yep, that's on my hitlist with this latest batch of changes.

Privacy had to be added to the core, because it's too tightly integrated into the Jojo field object system to be done using hooks. It's also part of a bigger plan to add more 'flags' to fielddata, which allows this data to be used for other things.

Address, suburb, city etc were already in the user table (At least I don't recall adding them recently).

For one, it's safer to leave them in and not risk breaking code that relies on them being there, but also I think it's worth having them there. Some fields such as phone numbers will invariably be used by multiple plugins, so I think it's a good thing to standardise on a single field name rather than having plugins create multiple copies of a phone number field under different names.
Back to Forum Index : Back to General Discussion   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.