This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Bug in Subscriptions Module

There is a bug in subscriptions.module at line 72 (4.3.0 version). That line is part of concatenating an SQL query:

$queryn .= "WHERE n.status = 1 AND s.uid = $account->uid AND s.stype = \"node\" ";

The problem is that whenever the PHPSESSID cookie is empty or not yet set, $account->uid is null. This happens anytime the visitor comes to the page for the first time, since the page that sets the cookie does not yet have access to the cookie. See PHP.net documentation:

Cookies will not become visible until the next loading of a page that the cookie should be visible for. To test if a cookie was successfully set, check for the cookie on a next loading page before the cookie expires. Expire time is set via the expire parameter. A nice way to debug the existence of cookies is by simply calling print_r($_COOKIE);.

I fixed this by editing the conditional for which the script begins putting together the SQL query. Currently, this line (line 67) reads:

if (is_null($subscriptions[$account->uid])) {

I changed this to:

if ((is_null($subscriptions[$account->uid]))&&(!is_null($account->uid))) {

The result is that if there is no valid user ID for line 72, the query is skipped entirely. I haven't poked around the module enough to really be sure how subscriptions.module works in its entirety, so I'm not sure, but I would assume that $subscriptions[$account->uid] is a separate variable from $account->uid. I hope this fix doesn't entirely break the module, but perhaps the module authors can address this in future versions and/or patches. In the meantime, I will post the original error messages below, so that anyone else who encounters this problem might be able to turn this thread up in a search.

Per Node Access Content Hack?

I've read a bit in the forums about the effort to enhance user access levels, such as per node, and based on taxonomy. I just read that groups.module for 4.4 isn't working yet. I am trying to figure out how to hack the blog module to make it accessible to everyone - annonymous users - and then any other defined roles, while keeping the rest of the "content" non-accessible to annonymous users.

bug report for module privatemsg-4.4.0

problem:there alwasy displays a "0" in tag "view inbox (0) "
debug:the function "privatemsg_link" on privatemsg.module line 16 should include this code "global $user;"

Submission Queue - Modify to be next toc comments?

I am wanting a mod to have the submission queue rating option to be next to the comments at the bottom of a blog post? So that its easy for people to just click on + or - to rate it and move on?

Has anyone modded this or figured out a way to do this? I have seen it on some sites, but I dont have the PHP ability. Infact I have none. I have given it a crack but I am getting extremely frustrated.

user object serialisation

My drupal module allows the user to specify an interest in sections of the
site so that we can send targeted e-mails to our users when we feel we
have news of interest to them.

In order to create a module that is not specific to our organisation and
of use to others I've decided to create the list of interests in the
drupal database as the table upd_interests. I then query this table during
the edit_form hook so that the list of interests are displayed as
checkboxes. So far so good, and the data is actually stored in the user
serialisation. My table looks something like

mysql> select * from upd_interests;
+-----+-----------------------------+-------------+
| iid | name                        | description |
+-----+-----------------------------+-------------+
|   1 | Broadcasting and Webcasting |             |
|   2 | Medicines                   |             |
|   3 | Digital Media               |             |
|   4 | Music                       |             |
|   5 | Software                    |             |
|   6 | Textbooks                   |             |
|   7 | Traditional Knowledge       |             |
+-----+-----------------------------+-------------+

The expression of interest is stored as a boolean value in the user
serialisation.

$rs = db_query("select * from upd_interests");
while ($r = db_fetch_object($rs)){

Dynamic date in a new module

I have added in my site a new module to borrow books. I need adding dynamically in my page the date of the day the loan is made in. I'm a beginner... Help me, please! Thanks!

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions