Automatic profile label generation
Last updated on
30 April 2025
The profile label is by default the same as the profile type label, however it's possible to customize the profile label via custom code or Rules.
To specify a pattern for the profile label generation using Rules, the following steps are necessary.
- Be sure to have a Profile2 version from 04.01.2012 or later running (e.g. >= version 1.2) and to have the Rules module enabled.
- Create a suitable rule, which updates the profile label on event "Before saving a profile". Alternatively, just import the following example rule:
{ "rules_generate_a_profile_label" : {
"LABEL" : "Generate a profile label",
"PLUGIN" : "reaction rule",
"TAGS" : [ "profile2" ],
"REQUIRES" : [ "rules", "profile2" ],
"ON" : [ "profile2_presave" ],
"IF" : [ { "data_is" : { "data" : [ "profile2:type" ], "value" : "main" } } ],
"DO" : [
{ "data_set" : {
"data" : [ "profile2:label" ],
"value" : "[profile2:user:name]\u0027s [profile2:type:label]"
}
}
]
}
}If you are using the provided rule, make sure it's activated for your profile type by editing the condition and customize the user pattern by editing the action.
That's it. Once you have edited a profile using the profile pages module, you'll notice the new profile labels appearing in the page title(s). But take note, profile labels are only updated when a profile is saved, i.e. created or updated.
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion