Showing posts with label Drupal Customization. Show all posts
Showing posts with label Drupal Customization. Show all posts

Friday, January 23, 2009

Customising the user profile layout

(Thanks to Dublin Drupaller for starting this section of the handbook)

The PHP Snippets below are intended for use within a customised USER PROFILE page that simply enables you to “pull” specific content from your drupal database specific to a particular user and display it in the way you want.

They are intended for use with a phptemplate based theme and for Drupal site developers who do not have php programming knowledge but want to push out the boundaries of user profile pages and control precisely how they look.

See also Advanced Profile Kit for an alternate method of sprucing up your user profile pages.

Simple step-by-step instructions are provided.
The concept

Drupal is an extremely powerful tool for building online communities, in particular, allowing users to submit their own content to a community hub. A good illustration of this working well online might be the World famous myspace.com site, where bands/artists are able to submit content into their own page.

Drupal has all the tools available to create your own myspace.com style community hub.

These snippets are intended as a mini-repository and as an aid for site designers without php programming skills to create sophisticated User Profile Pages for members of their community.

Customised User Profile Pages maybe applied to many applications. myspace.com is primarily a site for artists & bands, but, similar techniques could be used for other applications such as a rzye.com (Drupal powered community hub) style professional networking hub or terminus1525 (Drupal powered community hub) for studios.
Getting Started - (Drupal 4.x and Drupal 5.x)

Step 1 - is to override the default User Profile page layout by uploading the special template.php file to your active theme folder.

$account, ‘fields’ => $fields));
}
?>

If you already have a template.php file in your active theme folder, simply add the above to the existing template.php file and upload it.

Step 2 - (Drupal 4.x and 5.x) is to create your customised user_profile.tpl.php file and upload that to your active theme folder.

If you’re starting from scratch, simply open notepad.exe or a similar text editor and paste in the snippets linked below to build your custom user profile page. Save it with the user_profile.tpl.php filename and upload it to your theme folder along with the template.php file.

Once you have got started with your first user_profile.tpl.php file, you can experiment with adding in more snippets or including HTML layout controls to get a feel for the flexibility this allows.
Getting Started - (Drupal 6.x)

Step 1 - is to override the default User Profile page layout by uploading a custom user-profile.tpl.php* file to your active theme folder.

Drupal will automatically detect the presence of your custom user-profile.tpl.php and override the default user profile layout. To make this happen, you need to rebuild the theme registry, which you can do by clearing the caches (for example using the button on the admin/settings/performance page), or simply by visiting the admin/build/modules page.

* note that in Drupal 6.x, your custom user profile layout file name uses a hyphen, instead of an underscore.

Step 2 - is to customise your user-profile.tpl.php layout file.

By default, all user profile data is printed out with the $user_profile variable. If there is a need to break it up you can use $profile instead.

As an example, the following snippet inserted in your custom user-profile.tpl.php will display the default user profile layout.

Available variables:

* $user_profile: All user profile data. Ready for print.
* $profile: Keyed array of profile categories and their items or other data provided by modules.

To check for all available data within $profile, insert the following snippet at the bottom of your custom user-profile.tpl.php.

Available variables

The following is a list of variables that is available to your custom user-profile.tpl.php.

'. check_plain(print_r($profile, 1)) .'

‘; ?>

How to use these snippets

Simply copy and paste these snippets into your custom user profile layout file and upload it to your active theme folder. Check to make sure that the snippet you are using is compatible for the version of Drupal you are using.

It’s recommended that you test your customised user_profile.tpl.php(Drupal 4.x or Drupal 5.x) or user-profile.tpl.php file (Drupal 6.x) on a test installation before adding to a live site.
Adding new snippets

Simply click on the ADD NEW CHILD PAGE link below and create a new handbook page. Include any dependencies, such as which version of Drupal you have tested the snippet with or extra modules that need to be enabled for the snippet to work.

PLEASE NOTE! The following snippets are user submitted. Use at your own risk! For users who have setup drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.

* A basic User Profile Page to help get you started
* Customising the user profile pages (a “before” and “after” example with screenshots)
* User Profile avatar/picture Snippet
* Handling single-line profile fields
* Handling multi-line profile fields
* Handling checkbox profile fields
* Handling freeform profile fields
* Handling URL profile fields
* Recent weblog entries (titles) snippet
* Recent weblog entries (titles & teasers) snippet
* Add/delete to/from buddylist snippet
* Display a list of buddies snippet
* Display list of (x) recent posts (titles) snippet
* User “history” or “member for: (time)” snippet
* Adding layout and content to the default user profile theme
* allow users to choose whether certain profile fields are visible or hidden
* Allowing users to customize their profile
* Custom User Blocks and User Tables PHP Snippets
* Customising the user profile layout per role
* Display link to user’s embedded gallery (or not if it does not exist)
* Display a customisable “this user is [online/offline]” status message in the User Profile page
* Display a user friendly text message when profile fields are left blank
* Display a user’s points value from the userpoints.module
* Display recent nodes (titles & teasers) snippet
* Displaying counts from the Invite module
* Drupal V5.x warning: Cannot add header information
* Handling date profile fields
* Howto: Make the user profile layout compact (with css only)
* Insert Subscribed Organic Groups List
* Messages for unpublished profiles
* My Comments Block for Profiles
* Outputting full civiCRM profile to custom profile
* Outputting individual CiviCRM profile fields into custom Drupal profile
* User Profile Page
* User referral module
* Weight sorting for input fields (when the user fill the form) doesn’t apply - fix
* Insert user friendly “click here to add your..” links when user profile fields are left blank
* Display a date related notice or countdown snippet
* Send private message snippet
* Display a Skype “Call me” or “leave a voicemail” button depending on Users’ online/offline status
* Display users age based on a date-of-birth field
* insert a “view your order history” and “view [username]s store” link
* Show/hide certain profile fields depending on user role or user permissions

Wednesday, January 21, 2009

Blog to it - The social blog directory

Blog to it is a social blog directory developed using 100% contrib modules. Well, there were a few tweaks to one module and a few more tweaks in the theme. This case study has been written to give an insight into how and why Blog to it was developed.

What is it?

"Do you have a blog that you would like to share with others? Do you enjoy reading blogs but don’t know where to effectively look for them? If you’re in this predicament, drop by Blog.to.it and take a look at what they have for you to enjoy.

Blog.to.it is a website that allows users to import all of their blog posts via RSS or start a new blog directly on their site. The site has eight different blog categories including technology, business, science, gaming, lifestyle, entertainment, sports, and other. Whatever you want to write or read about is easy to find, just look through the categories that interest you most.

Once posts are in they can be voted on, commented on, and sorted by rating, category, or date. Blog.to.it hopes to be a great place to find new blogs to read. The site merges loads of features from current sites and brings them to a new audience, the personal blogger. There are many blogs world wide and it is often hard to get noticed between all the corporate blogs out there, this site is trying to help bloggers come together in a space that’s just for them."
From Killer Startups

Features

  • Hosted user blogs - Just like on Blogger or Wordpress a user can start blogging on Blog to it, this isn't a key feature but was more or less there, so why not use it.
  • RSS user blog import - This is the key driver of the site by allowing users to add their existing blog posts automatically to Blog to it.
  • Blog post commenting - It was never fully decided if this should be on the site or not, should comments be on Blog to it or on the original blog. Maybe one to work on?
  • Blog post rating / voting - This also another key feature. The main way to view posts is by number of votes. (Digg like)
  • Browse posts by rating
  • Browse posts by date
  • Browse posts by category
  • Browse posts by user / blog
  • Browse blogs by tag
  • Personal and site wide Twitter updates - This is a really great feature to have. It both helps the user integrate more with the site, and is a great marketing tool. A lot of the traffic is coming from Twitter and Twitter aggregation.

How was it done?

Modules

Blog to it screenshot
The whole site was developed using Drupal 6 and then moved to Acquia Drupal once live. It is heavily based around the core blog module because user blogs are created in the default Drupal way, and RSS imports are imported into the Blog content type.

By using the DrupalMU Helper module which is part of the Drupal MU install profile it helped turn the core blog module into a multi-user blogging system and gives vital functions that were used when creating views and the theme.

One of the other key modules was the FeedAPI module which is used to import an external blog into the blog content type via RSS feed. The Content Profile was used to add the RSS feed URL field to the user's profile. Simple feed was also looked into as a way of importing feeds, but it didn't seem to attach the imported nodes to the user who setup the import. This may of been a development error rather than a fault with the module, but FeedAPI was suggested a better module, and it worked.

Posts can be voted on using the VotingAPI and Plus1 modules. Voting API was an obvious choice when creating a site that requires voting, but which module to use with Voting API was a harder choice. Drigg seems the most advanced to allow +1 and -1 voting, but this was not available for Drupal 6 (it was tested once the first 6 release and seemed too specific), so after spending a few hours installing, testing and uninstalling Plus1 seemed to offer what was needed for the Blog to it use case.

This site is not very complex, but works well. The uptake has been good and by adding Twitter integration this helps with marketing. The Twitter module allows each user to import their Twitter posts, and announce their new posts on Twitter. It also allows the announcement of all new posts via Triggers and Actions on http://twitter.com/blogtoitnew.

Views also plays a big part in this site, much like it does in other sites. It allows many pages to be developed showing the posts in different ways. There is one main view for the site which creates three pages for each category.

Theming

The theme was based upon Raincity's Basic theme, this really helped speed up development. There was very little special development in the theme. The only exciting aspect is the use of the Drupal MU helper functions. The function returns the UID of the user whose blog or profile is being viewed. This allowed custom theming for user pages such as hiding the Blog to it logo and displaying the site name.

Infrastructure

The site was developed on a budget VPS from VPS Empire who has now merged with VA Serv. After launch and after a lot of hunting a hosting partnership was found with Castlegem, so far the site has been running very well, and Castlegem were great at getting the server setup, including custom nameservers, DNS and backup.

What next?

Blog to it screenshot
Blog to it has currently been released as an Alpha version so many of the bugs can be ironed out. Development will continue until the beta version is ready early 2009.

So far very few bugs have been found, the hardest aspect seems to be perfecting the usability. For example, should anonymous users be able to vote and comment? what should be displayed on each page? what is a "top post"?

Also because there are so many posts being imported cron needs to run every 2 mins. This means that on each cron run there is only 1-2 posts and twitter updates being imported, where as if cron was run every hour there many be 50+ posts and twitter updates being imported. This also helps the site stay very up to date, but puts a big strain on the server

There are many ideas of how to move the site and project forward, and by using an array of contrib and custom modules it is planned to add more social features to the site. Such as friends and / or followers, what posts your friends have added, other people who have voted on this post. It is also planned to launch a more feature rich profile page displaying a user's friends and what posts they have voted on.

Please head over to Blog to it, register, add your blog and vote up posts you like.

Monday, September 8, 2008

Open Source CMS Development

To grow your web site, you have to reduce your dependence on the programmer or the web developer to manage content like to edit, upload or delete, as the world moves towards a more collaborative form of content generation. How much speed your web site replicate the proper content for the appropriate people and allow them to place their own suggestions and content describes your website, and will carry on doing so in the future too.

You can leverage open source web content management systems to professionally handle content on your live web site or local web site. Many open source CMS are liberally accessible to download, but it needs to modify and improve them so that they can be made appropriate for your necessities.

Open Source Content Management System User’s Advantages:

• Quick Improvement of collaborative, social media websites
• Decrease dependence on web developers for daily tasks related to content
• You can change features and themes in a click of a button
• Build a strong information architecture
• To publish web content learning curve will be shorten.
• Security level of content will be stronger
• Give user rights
• You can have the facility to change or restructure the website when ever you want.

Virtueinfo Offers Open Source CMS Development solutions to all kind of organizations including business clients, individual bloggers, social media web sites, web site designers, web developers.

Open source content management system customization:

Virtueinfo specialized to build custom web based CMS using Drupal, Joomla and several other applications. We can do all kind of work from template integration to custom component development for these CMS web applications. We have implemented CMS for hundreds of clients of different industries; our web developer team realizes the unique features, pros and cons of the popular open source CMS technologies. Getting understand requirements of clients we suggest solution which will meet your necessities completely.

At Virtue info we offer Open Source CMS Development & Open Source CMS Customization which includes Drupal Development, Joomla Development, Drupal Customization, Joomla Customization, Drupal Design Integration.

For a complete quote for your Open Source CMS requirements, contact us at info@virtueinfo.com.

Get ready to experience excellence with us!