# Registration and automatic login

**URL:** <https://community.hivepress.io/t/registration-and-automatic-login/7997>\
**Category:** HivePress\
**Created:** [October 29, 2023, 6:09pm UTC](https://community.hivepress.io/t/registration-and-automatic-login/7997 "2023-10-29T18:09:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sinen](https://community.hivepress.io/user_avatar/community.hivepress.io/sinen/32/7266_2.png) [@Sinen](https://community.hivepress.io/u/Sinen)\
**Post date:** [October 29, 2023, 6:09pm UTC](https://community.hivepress.io/t/registration-and-automatic-login/7997/1 "2023-10-29T18:09:38Z")

</div>

Good morning  
how can I ensure that all visitors to my site post an ad with the same account without registration as on your live demo site?  
That’s what you say when he visits my site they are all automatically connected to a single account and can post an ad without having to register.

 ![live demo](https://community.hivepress.io/uploads/default/original/2X/4/4db757015b9264d8a56c772b9b226dbe0ed7e9e2.png)

---

<div class="post-metadata">

**Author:** ![andrii](https://community.hivepress.io/user_avatar/community.hivepress.io/andrii/32/2951_2.png) [@andrii](https://community.hivepress.io/u/andrii)\
**Post date:** [October 30, 2023, 2:03pm UTC](https://community.hivepress.io/t/registration-and-automatic-login/7997/4 "2023-10-30T14:03:28Z")

</div>

Hi,

Unfortunately, there is no such function, it requires a custom implementation. As for the demo site, we simply created one user and added autocomplete at login using a custom implementation. If you need a PHP snippet, we can provide it. But please note that any user will be able to enter the site, delete a listing, or edit it.

---

<div class="post-metadata">

**Author:** ![Sinen](https://community.hivepress.io/user_avatar/community.hivepress.io/sinen/32/7266_2.png) [@Sinen](https://community.hivepress.io/u/Sinen)\
**Post date:** [October 30, 2023, 3:33pm UTC](https://community.hivepress.io/t/registration-and-automatic-login/7997/5 "2023-10-30T15:33:27Z")

</div>

Yes I would like to have the PHP snippet please and thank you for your advice but I will use it for visitors because I have disabled add an ad Thank you

---

<div class="post-metadata">

**Author:** ![andrii](https://community.hivepress.io/user_avatar/community.hivepress.io/andrii/32/2951_2.png) [@andrii](https://community.hivepress.io/u/andrii)\
**Post date:** [October 31, 2023, 1:43pm UTC](https://community.hivepress.io/t/registration-and-automatic-login/7997/8 "2023-10-31T13:43:18Z")

</div>

Hi,

Please use this PHP snippet ([How to add custom code snippets - HivePress Help Center](https://help.hivepress.io/article/23-how-to-add-custom-code-snippets)):

```auto
add_filter(
	'hivepress/v1/forms/user_login',
	function( $form ) {
		$form['fields']['username_or_email']['default'] = 'demo';

		$form['fields']['password']['default'] = 'demo';
		$form['fields']['password']['type'] = 'text';

		return $form;
	}
);

```

Please note that it can require further customization.

---

<div class="post-metadata">

**Author:** ![Sinen](https://community.hivepress.io/user_avatar/community.hivepress.io/sinen/32/7266_2.png) [@Sinen](https://community.hivepress.io/u/Sinen)\
**Post date:** [October 31, 2023, 2:13pm UTC](https://community.hivepress.io/t/registration-and-automatic-login/7997/9 "2023-10-31T14:13:35Z")

</div>

Thanks a lot !

---

<div class="post-metadata">

**Author:** ![Sinen](https://community.hivepress.io/user_avatar/community.hivepress.io/sinen/32/7266_2.png) [@Sinen](https://community.hivepress.io/u/Sinen)\
**Post date:** [November 1, 2023, 7:27pm UTC](https://community.hivepress.io/t/registration-and-automatic-login/7997/10 "2023-11-01T19:27:20Z")

</div>

the PHP snippet works wonderfully just one last question can add a code to validate automatically

 ![12](https://community.hivepress.io/uploads/default/original/2X/f/f783021082553bc493b034f6f5606d7f2ec3dfb6.png)

---

<div class="post-metadata">

**Author:** ![andrii](https://community.hivepress.io/user_avatar/community.hivepress.io/andrii/32/2951_2.png) [@andrii](https://community.hivepress.io/u/andrii)\
**Post date:** [November 3, 2023, 7:26am UTC](https://community.hivepress.io/t/registration-and-automatic-login/7997/13 "2023-11-03T07:26:56Z")

</div>

Hi,

Sorry, there’s no simple code snippet for this, it would require a custom implementation. If customizations beyond the available features are required for your site, please consider hiring someone for custom work [Fiverr - Freelance Services Marketplace](https://fvrr.co/32e7LvY)

---

<div class="post-metadata">

**Author:** ![system](https://community.hivepress.io/user_avatar/community.hivepress.io/system/32/13990_2.png) [@system](https://community.hivepress.io/u/system)\
**Post date:** [December 3, 2023, 7:27am UTC](https://community.hivepress.io/t/registration-and-automatic-login/7997/14 "2023-12-03T07:27:20Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
