-1

I am taking a look in the Profile 2 API documentation: http://api.drupalhelp.net/api/profile2/function

I guess profile_create() or profile2_save() are what I need. But I have read somewhere profile_create() is deprecated.

Any example for how to create a Profile 2 profile programmatically?

2
  • 1
    Note that that is not an official help/docs site.
    – Kevin
    Commented Nov 11, 2019 at 21:45
  • 1
    @Alfonso_MA – Where have you read that? Have you already tried the mentioned functions? Or simply looked into the module's code?
    – leymannx
    Commented Nov 11, 2019 at 21:55

1 Answer 1

2

Yes profile_create() is deprecated. You should use profile2_create() instead.

See the profile2.module file:

/**
 * Deprecated. Use profile2_create().
 */
function profile_create(array $values) {
  return new Profile($values);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.