Could someone make this module compatible with Drupal 4.7 if it isn't already? I'd love to use this great module with the new version of Drupal.

CommentFileSizeAuthor
#11 blog_theme.module2.61 KBwmostrey
#9 blog_theme-4.7.0.module2.62 KBwmostrey

Comments

MadKad’s picture

Me to please can some one do it

keycoke’s picture

Me too. I like and need this module to build my community site.
Dear Blog Theme's devel, please upgrade it...

Carlos Miranda Levy’s picture

I took a look at the code and it did not look that difficult to make it work in 4.7. However, since I'm not familiar with the recent 4.7 changes in API, I decided to write a module from scratch for 4.7. There is a problem, however, with my code. When I enable it, I get the following error when displaying the main node page (which is the default frontpage too):

    * warning: Invalid argument supplied for foreach() in /home/ciudades/public_html/modules/node.module on line 359.
    * warning: implode(): Bad arguments. in /home/ciudades/public_html/modules/node.module on line 363.
    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /home/ciudades/public_html/includes/database.mysql.inc on line 120.

I opened a forum discussion on this issue at http://drupal.org/node/75300

Another issue, however not related to my code, but inherent to recent changes in 4.7 is that when you use different themes, the configuration of optional blocks is lost. In my case, the "About Me" custom block I use to show the user profile on the top right hand :-( (the code for that block is in http://drupal.org/node/75277)

Here's the code:

// $Id$ mycustomtheme.module,v 0.9 2006/7/24 14:38:00 Carlos Miranda Levy Exp $ 

/**
 * @mycustomtheme.module
 * This module uses the theme selected by users when displaying their posts and user pages.
 * It's supposed to update/substitute blog_theme.module which has not been updated to 4.7
 * It's just a few lines of code, less than 20, including brackets and stuff.
 * It's an important feature for those who want to allow members of their communities to choose 
 * from different themes for their pages, like most blogging communities do.
 * 
 * There is one problem to be fixed and it is that if the default front page is used (node),
 * an error is displayed. Just go to admin/settings and change default front page to "blog"
 * until a solution is found.
 */

/**
 * Implementation of hook_help().
 */
function mycustomtheme_help($section) {
  switch ($section) {
    case 'admin/help#mycustomtheme':
      return t('This module uses the theme selected by users when displaying their posts and user pages.');
    case 'admin/modules#description':
      return t('Uses the theme users pick in their profile when displaying their posts and user pages');
  }
}


/**
 * Implementation of hook_init().
 */
function mycustomtheme_init() {
}


/**
 * Implementation of hook_menu().
 */
function mycustomtheme_menu($may_cache) {
	// If it's
	// main blog page for user, then arg(0)="blog"; arg(1)=user id.
	// blog post, then arg(0)="node"; arg(1)=node id.
	// user page, then arg(0)="user"; arg(1)=user id.

	global $custom_theme;
	switch (arg(0)) {
		case "blog":
			$uid = arg(1);
			break;
		case "node":
			$currentnode = node_load(arg(1));
			$uid = $currentnode->uid;
			break;
		case "user":
			$uid = arg(1);
			break;
	}

	$user = user_load(array((is_numeric($uid) ? 'uid' : 'name') => $uid, 'status' => 1));
	profile_load_profile(&$user);

	if (arg(0) == 'node' or arg(0) == 'blog' or arg(0)== 'user') {
		if (arg(1) and arg(1)!=="add" and arg(0)!=="forum")
		{
			$themes = list_themes();
			$custom_theme = $user->theme && $themes[$user->theme]->status ? $user->theme : variable_get('theme_default', 'bluemarine');
		}
	}
}


/**
 * Implementation of hook_block().
 */
function mycustomtheme_block($op = 'list', $delta = 0, $edit = array()) {
  if ($op == 'list') {
    $blocks[0]['info'] = t('About Me');
    // OPTIONAL: Add additional block descriptions here, if required.
    return $blocks;
  }
  else if ($op == 'configure') {
    // OPTIONAL: Enter form elements to add to block configuration screen, if required.    
  }
  else if ($op == 'save') {
    // OPTIONAL: Add code to trigger when block configuration is saved, if required.
  }
  else if ($op == 'view') {
    switch ($delta) {
      case 0:
        $block['subject'] = t('About Me');
        $block['content'] = t('I have uploaded code for this at http://drupal.org/node/75277');
        break;
      // OPTIONAL: Enter additional cases for each additional block, if defined.
    }
    return $block;
  }
}

abqaria’s picture

So will the cvs version or the 4.6 version work with 4.7 drupal ?
or should i add this code ?

absolutepsx’s picture

Would it be possible to get an update on if there is a now working 4.7 version of this code ?

NukeHavoc’s picture

I'll echo the request for a formal 4.7 compatible version of this module -- my users are interested in customizing their blogs, and while we're presently using 4.6, I don't want to lose that ability when moving to 4.7. Carlos, any chance you want to take over maintenance of this module?

Or is there a better way to do this in 4.7 that we're all missing?

wmostrey’s picture

Hey all,

I could be mistaking ofcourse but the 4.6 module works perfectly in 4.7. Are you experiencing any errors in 4.7?

chlobe’s picture

I have installed blogtheme module on two sites running 4.7.3 and neither works.

If I could code I would be happy to try and update it but I do not have the skills. If contributing towards a bounty would help get things moving I'd be happy to chip in.

wmostrey’s picture

StatusFileSize
new2.62 KB

I really had no issues on 4.7.3. I cleaned and updated the code a bit, so you can try the attached version. It works perfectly on my 4.7.3 installation.

To test if it works: have a user set its default theme to a non-default theme, and browse it from user anonymous for instance.

chlobe’s picture

Thanks for posting the updated code: still not working, receiving a

"Parse error: syntax error, unexpected '=' in modules/blogtheme.module on line 30"

wmostrey’s picture

StatusFileSize
new2.61 KB

Ah that appears to be a wrong version, try this one.

lias’s picture

Was this version ever tried for 4.7? I'm on 5 and wondering how much work is involved to upgrade it to drupal latest. I've also visited the corresponding issue you mentioned here: http://drupal.org/node/75300

I've sent an email to the developer to see if there are plans to update to 5, will let you know if I hear back.
Lsabug

Carlos Miranda Levy’s picture

Title: 4.7 compatibility » Taking over this module

Sorry, I've been busy and since I got this feature working on 4.7 (http://drupal.org/node/75300), I had not returned here.

But now I'm planning to upgrade my sites to 5.x, so I need to get this working again.

I'm willing to take over this module and get it working for 5.x during the weekend.

What's the procedure?

beginner’s picture

Title: Taking over this module » 4.7 compatibility
Version: master » 4.7.x-1.0
Status: Active » Fixed
beginner’s picture

Assigned: Unassigned » beginner
Category: feature » task
Anonymous’s picture

Status: Fixed » Closed (fixed)