blogapi_validate_user

Definition

blogapi_validate_user($username, $password)
modules/blogapi/blogapi.module, line 556

Description

Ensure that the given user has permission to edit a blog.

Code

<?php
function blogapi_validate_user($username, $password) {
  global $user;

  $user = user_authenticate($username, $password);

  if ($user->uid) {
    if (user_access('administer content with blog api', $user)) {
      return $user;
    }
    else {
      return t("You either tried to edit somebody else's blog or you don't have permission to edit your own blog.");
    }
  }
  else {
    return t('Wrong username or password.');
  }
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.