当前位置: 首页>>代码示例>>PHP>>正文


PHP JUser::delete方法代码示例

本文整理汇总了PHP中JUser::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP JUser::delete方法的具体用法?PHP JUser::delete怎么用?PHP JUser::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JUser的用法示例。


在下文中一共展示了JUser::delete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 public function delete()
 {
     $db =& JFactory::getDBO();
     $query = 'DELETE FROM ' . $db->nameQuote('#__community_users') . ' ' . 'WHERE ' . $db->nameQuote('userid') . '=' . $db->Quote($this->id);
     $db->setQuery($query);
     $db->query();
     return parent::delete();
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:8,代码来源:user.php

示例2: onDeleteRowsForm

 /**
  * run from table model when deleting rows
  *
  * @return bol
  */
 function onDeleteRowsForm(&$params, &$formModel, &$groups)
 {
     if ($params->get('juser_field_userid') != '' && $params->get('juser_delete_user', false)) {
         $useridfield = $this->getFieldName($params, 'juser_field_userid');
         $useridfield .= '_raw';
         foreach ($groups as $group) {
             foreach ($group as $rows) {
                 foreach ($rows as $row) {
                     if (isset($row->{$useridfield})) {
                         if (!empty($row->{$useridfield})) {
                             $user = new JUser((int) $row->{$useridfield});
                             // Bail out now and return false, or just carry on?
                             if (!$user->delete()) {
                                 JError::raiseWarning(500, 'Unable to delete user id ' . $row->{$useridfield});
                             }
                         }
                     }
                 }
             }
         }
     }
     return true;
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:28,代码来源:fabrikjuser.php

示例3: testCreateDeleteUser

	/**
	 * Testing creation and deletion of users
	 *
	 * @return void
	 */
	public function testCreateDeleteUser()
	{
		include_once JPATH_BASE . '/libraries/joomla/event/dispatcher.php';
		include_once JPATH_BASE . '/libraries/joomla/plugin/helper.php';
		include_once JPATH_BASE . '/libraries/joomla/application/application.php';

		//JFactory::getApplication('site');
		$mockSession = $this->getMock('JSession', array('_start', 'get'));
		$mockSession->expects($this->any())
			->method('get')
			->will($this->returnValue($this->object)
		);
		JFactory::$session = $mockSession;

		$testUser = new JUser();
		$testUser->name = "Floyd Smoot";
		$testUser->username = "Floyd";

		$this->assertThat(
			$testUser->id,
			$this->equalTo(0),
			"Newly created id should be zero"
		);

		$this->assertThat(
			$testUser->save(),
			$this->isFalse(),
			'Cannot save without valid email'
		);

		$this->assertThat(
			$testUser->getErrors(),
			$this->equalTo(
				array('JLIB_DATABASE_ERROR_VALID_MAIL')
			),
			'Should have caused valid email error'
		);

		$testUser->email = "harry@sally.com";
		//TODO: Fix this assertion
		$this->assertThat(
			$testUser->save(true),
			// Should be false
			$this->isTrue(),
			'Line: ' . __LINE__ . ' Should not create new user when update only flag is set'
		);

		//TODO: Fix this assertion
		$this->assertThat(
			$testUser->save(),
			// Should be true
			$this->isFalse(),
			'Line: ' . __LINE__ . ' Should save the user successfully'
		);

		$this->assertThat(
			$testUser->id,
			$this->greaterThan(0),
			'Line: ' . __LINE__ . " Newly saved id should not be zero"
		);

		$testUser->email = "sally@harry.com";
		//TODO: Fix this assertion
		$this->assertThat(
			$testUser->save(),
			// Should be true
			$this->isFalse(),
			'Line: ' . __LINE__ . ' Should update existing user.'
		);

		$testUser1 = JUser::getInstance('Floyd');
		$this->assertThat(
			$testUser1->id,
			$this->equalTo($testUser1->id),
			'Line: ' . __LINE__ . " Id's should be the same"
		);

		$this->assertThat(
			$testUser->delete(),
			$this->isTrue(),
			'Line: ' . __LINE__ . ' Delete should succeed'
		);

		$testUser2 = JUser::getInstance('Floyd');
		$this->assertThat(
			$testUser2,
			$this->isFalse(),
			'Line: ' . __LINE__ . " Id should not be found"
		);

	}
开发者ID:realityking,项目名称:JAJAX,代码行数:96,代码来源:JUserTest.php

示例4: delete

 function delete()
 {
     $cids = JRequest::getVar('cid', array(0), 'post', 'array');
     $item = $this->getTable('Customer');
     foreach ($cids as $cid) {
         if (!$item->delete($cid)) {
             $this->setError($item->getErrorMsg());
             return false;
         }
     }
     jimport("joomla.database.table.user");
     $db = JFactory::getDBO();
     $user = new JUser();
     foreach ($cids as $cid) {
         if (!$user->delete($cid)) {
             $this->setError($item->getErrorMsg());
             return false;
         }
     }
     return true;
 }
开发者ID:Shtier,项目名称:digicom,代码行数:21,代码来源:customers.php

示例5: delete

 /**
  * Override parent's delete implementation if necessary.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	bool	The delete state. True on success, false otherwise.
  */
 public function delete()
 {
     $state = parent::delete();
     // Once the user is deleted, we also need to delete it from the #__social_users table.
     if ($state) {
         // Perform cleanup here.
         $model = FD::model('Users');
         $model->delete($this->id);
     }
     return $state;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:19,代码来源:user.php

示例6: delete

 /**
  * Override parent's delete implementation if necessary.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	bool	The delete state. True on success, false otherwise.
  */
 public function delete()
 {
     $state = parent::delete();
     // Once the user is deleted, we also need to delete it from the #__social_users table.
     if ($state) {
         $model = FD::model('Users');
         $model->delete($this->id);
         JPluginHelper::importPlugin('finder');
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('onFinderAfterDelete', array('easysocial.users', $this));
     }
     return $state;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:21,代码来源:user.php

示例7: onDeleteRowsForm

 /**
  * Run from list model when deleting rows
  *
  * @param   array &$groups List data for deletion
  *
  * @return    bool
  */
 public function onDeleteRowsForm(&$groups)
 {
     $params = $this->getParams();
     if ($params->get('juser_field_userid') != '' && $params->get('juser_delete_user', false)) {
         $userIdField = $this->getFieldName('juser_field_userid');
         $userIdField .= '_raw';
         foreach ($groups as $group) {
             foreach ($group as $rows) {
                 foreach ($rows as $row) {
                     if (isset($row->{$userIdField})) {
                         if (!empty($row->{$userIdField})) {
                             $user = new JUser((int) $row->{$userIdField});
                             // Bail out now and return false, or just carry on?
                             if (!$user->delete()) {
                                 $this->app->enqueueMessage('Unable to delete user id ' . $row->{$userIdField}, 'error');
                             }
                         }
                     }
                 }
             }
         }
     }
     return true;
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:31,代码来源:juser.php


注:本文中的JUser::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。