Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#10 | user_relationships_2.patch | 1.58 KB | gwen |
#8 | user_relationship_2.patch | 18.66 KB | Annette Tisdale |
#6 | user_relationship_1.patch | 16.49 KB | Annette Tisdale |
#3 | user_relationship_0.patch | 17.6 KB | Annette Tisdale |
#1 | user_relationship.patch | 15.33 KB | Annette Tisdale |
Comments
Comment #1
Annette Tisdale CreditAttribution: Annette Tisdale commentedAttached is a patch with code changes for this enhancement.
Comment #2
sprsquish CreditAttribution: sprsquish commentedNice.
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]);
Comment #3
Annette Tisdale CreditAttribution: Annette Tisdale commentedAttached is an updated patch with defaults messages.
Comment #4
gwen CreditAttribution: gwen commentedComment #5
sprsquish CreditAttribution: sprsquish commentedAnnette, I emailed you my thoughts.
Comment #6
Annette Tisdale CreditAttribution: Annette Tisdale commentedre-factored code generating default messages.
Comment #7
gwen CreditAttribution: gwen commentedComment #8
Annette Tisdale CreditAttribution: Annette Tisdale commentedI 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.
Comment #9
sprsquish CreditAttribution: sprsquish commentedComment #10
gwen CreditAttribution: gwen commentedIt 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.
Comment #11
sprsquish CreditAttribution: sprsquish commentedFixed 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
Comment #12
sprsquish CreditAttribution: sprsquish commented