4.7 compatibility

canadrian@elect... - April 18, 2006 - 20:32
Project:Blog Theme
Version:4.7.x-1.0
Component:Code
Category:task
Priority:normal
Assigned:beginner
Status:closed
Description

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.

#1

MadKad - May 19, 2006 - 15:45

Me to please can some one do it

#2

keycoke - July 9, 2006 - 12:05

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

#3

Carlos Miranda Levy - July 24, 2006 - 19:14

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:

<?php
// $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 <a href="http://drupal.org/node/75277'" title="http://drupal.org/node/75277'" rel="nofollow">http://drupal.org/node/75277'</a>);
       
break;
     
// OPTIONAL: Enter additional cases for each additional block, if defined.
   
}
    return
$block;
  }
}
?>

#4

abqaria - July 29, 2006 - 11:28

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

#5

absolutepsx - September 20, 2006 - 07:18

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

#6

NukeHavoc - September 22, 2006 - 15:19

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?

#7

wmostrey - October 20, 2006 - 14:26

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?

#8

chlobe - October 23, 2006 - 00:43

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.

#9

wmostrey - October 23, 2006 - 12:51

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.

AttachmentSize
blog_theme-4.7.0.module 2.62 KB

#10

chlobe - October 24, 2006 - 12:22

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

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

#11

wmostrey - October 24, 2006 - 12:41

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

AttachmentSize
blog_theme.module 2.61 KB

#12

lsabug - January 26, 2007 - 16:16

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

#13

Carlos Miranda Levy - March 8, 2007 - 16:45
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?

#14

beginner - July 26, 2007 - 10:56
Title:Taking over this module» 4.7 compatibility
Version:HEAD» 4.7.x-1.0
Status:active» fixed

#15

beginner - July 26, 2007 - 11:07
Category:feature request» task
Assigned to:Anonymous» beginner

#16

Anonymous - August 9, 2007 - 11:18
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.