Openfire: Add user with subscription status as "both"
<p>I am facing issue when i add user using <a href="https://github.com/gidkom/php-openfire-restapi" rel="nofollow noreferrer">RestApi</a></p>
<pre><code>include &quot;vendor/autoload.php&quot;;
$api = new Gidkom\OpenFireRestApi\OpenFireRestApi;
$api-&gt;secret = &quot;mySecretKey&quot;;
$api-&gt;host = &quot;HostName&quot;;
$api-&gt;port = &quot;9090&quot;;
$api-&gt;useSSL = false;
$api-&gt;plugin = &quot;/plugins/restapi/v1&quot;;  // plugin 
</code></pre>
<p>For adding user to Roster i am using following code</p>
<pre><code>$jid=&quot;xyz@domainname&quot;;
//Add to roster
$data=$api-&gt;addToRoster(&quot;abc&quot;, $jid);
</code></pre>
<p>Which points to <code>OpenFireRestApi.php</code> which do have function named <code>addToRoster</code></p>
<pre><code> /**
     * Adds to this OpenFire user's roster
     *
     * @param   string          $username       Username
     * @param   string          $jid            JID
     * @param   string|false    $name           Name         (Optional)
     * @param   int|false       $subscription   Subscription (Optional)
     * @return  json|false                     Json with data or error, or False when something went fully wrong
     */
    public function addToRoster($username, $jid, $name=false, $subscription=false)
    {
        $endpoint = '/users/'.$username.'/roster';
        return $this-&gt;doRequest('post', $endpoint, compact('jid','name','subscription'));
    }
</code></pre>
<p>So I've used</p>
<pre><code>$data=$api-&gt;addToRoster(&quot;abc&quot;, $jid,&quot;DummyName&quot;,3);
</code></pre>
<p>Where 3 is subscription type as both = 3 which is <a href="https://www.igniterealtime.org/projects/openfire/plugins/userservice/readme.html" rel="nofollow noreferrer">mentioned.</a></p>
<p>But when i add user shows subscription type as <strong>none</strong> only.</p>
<blockquote>
<p><strong>UPDATE</strong></p>
</blockquote>
<p>I came to know about <a href="https://www.igniterealtime.org/projects/openfire/plugins/subscription/readme.html" rel="nofollow noreferrer">subscription plugin</a></p>
<p>So I've installed plugin configure it
<a href="https://i.stack.imgur.com/C8YLh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C8YLh.png" alt="enter image description here" /></a></p>
<p>Plugin itself says it will automatically subscribe both way.</p>
<p>Afterwards i've again tried with</p>
<pre><code>$data=$api-&gt;addToRoster(&quot;abc&quot;, $jid);
</code></pre>
<p>Which aspects to be working but again subscriptions is <strong>none</strong> only.</p>
<p>Any Help would be appreciated.</p>