Extract the Notification message which are currently hard-coded and store them in the variables DB table. Update settings page to allow administrators to modify the notification text.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Annette Tisdale’s picture

Status: Active » Needs review
FileSize
15.33 KB

Attached is a patch with code changes for this enhancement.

sprsquish’s picture

Status: Needs review » Needs work

Nice.

Needs a little work though:
variable_get requires the second ($default) argument. There are places where this is missed.

The variables wont necessarily be set to their default states so it's important that the default argument is an actual message. I'd suggest creating a function called _user_relationship_message_defaults that returns an array with keys that match the names of the variable_get variables. Then it'd be easy to do the following:

$default_messages = _user_relationship_message_defaults();
$msg_name = 'user_relationships_msg_too_many_relations';
$msg = variable_get($msg_name, $default_messages[$msg_name]);

Annette Tisdale’s picture

FileSize
17.6 KB

Attached is an updated patch with defaults messages.

gwen’s picture

Status: Needs work » Needs review
sprsquish’s picture

Status: Needs review » Needs work

Annette, I emailed you my thoughts.

Annette Tisdale’s picture

FileSize
16.49 KB

re-factored code generating default messages.

gwen’s picture

Status: Needs work » Needs review
Annette Tisdale’s picture

FileSize
18.66 KB

I have added a small change to make the plural name of the relationship available. A new patch is attached, containing this and the previously updated code.

sprsquish’s picture

Status: Needs review » Closed (fixed)
gwen’s picture

Status: Closed (fixed) » Needs review
FileSize
1.58 KB

It looks like the code was checked in without the ability to set an empty string as a notification. Also missing is the fix to hunt out messages in arrays #2 - n. A patch is attached.

sprsquish’s picture

Fixed the blank string issue.

I'm still not clear on what's happening for you with that recursive function. Through my tests it's working just as it should

sprsquish’s picture

Status: Needs review » Closed (fixed)