Skip to content

Instantly share code, notes, and snippets.

View NikLP's full-sized avatar

NikLP NikLP

  • Nottingham, UK
  • 07:39 (UTC -12:00)
  • X @NikLP
View GitHub Profile
# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# uncomment the following:
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@NikLP
NikLP / gist:4a2b3aa5359017359b29
Created October 22, 2015 15:16
Profile2 "profile page" title set using entity_metadata_wrapper in hook_entity_view
/*
* Implementation of hook_entity_view
*/
function helpermodule_entity_view($entity, $type, $view_mode, $langcode) {
// we're viewing an entity
// check if it's a profile2 type
// - if there's more than one profile2, check for that too!
// - and the view mode is 'page' (not 'full', for profile2 it seems)
if ($type == 'profile2' && $entity->type == 'member' && $view_mode == 'page') {